// 再帰呼び出しで総当たりを再現 void put_loop(int depth) { // セルの数の深さになったら抜ける if (depth == DEPTH) return; // 現在の記号取得 const int KIGOU = depth%2 ? BATU : MARU; for (int i=0; i<DEPTH; i++) { // 第一手に関しては中央以降にはコマを置かない if (depth==0 && i>=CENTER) return; if (is_put(i)) { // 置ける put(i, KIGOU); // 置く //print(); // 置けたら常に記号が揃ってるか確認 int flag = check_finish(depth); if (flag) { //print(); dell(i); continue; } // 次の人に処理を移す depth++; put_loop(depth); // 前に置いたのを削除し、forのループにて別の場所に置く dell(i); depth--; } else { // 置けない continue; } } }
void main() { int n ; s: clrscr(); printf("Implementation of doubly linked list :\n\n"); printf("Select your choice :\n"); printf("1. Insertion from first :\n") ; printf("2. Insertion from last :\n") ; printf("3. Deletion from first :\n"); printf("4. Deletion from last :\n"); printf("5. Deletion from middle :\n") ; printf("6. Display :\n"); printf("7. Exit :") ; scanf("%d",&n) ; switch(n) { case 1: inf(); getch();goto s; case 2: inl(); getch();goto s; case 3: delf(); getch();goto s; case 4: dell(); getch();goto s; case 5: delm(); getch();goto s; case 6: display(); getch(); goto s; case 7: break; } }
void MainWindow::on_btn_dellDoc_clicked() { while(ui->tw_tab->selectedItems().count() > 0) { QString title; int col = 0; int lig = ui->tw_tab->currentIndex().row(); title = ui->tw_tab->item(lig,col)->data(0).toString(); lib.remove(ui->tw_tab->selectedItems().at(0)->row()); dell(title.toStdString()); ui->tw_tab->removeRow(ui->tw_tab->selectedItems().at(0)->row()); } ui->btn_dellDoc->setEnabled(false); }
//function to calculate the determinant int determinant(int** matrix, int n){ int val = 0, i, **mat ; if(n==1){ return matrix[0][0]; } else{ for(i=0;i < n;i++){ if(matrix[0][i]==0)continue; else { mat = create_matrix(n-1); val += dell(i) * matrix[0][i] * determinant(findMinor(matrix,0, i, n-1,mat), n -1); free_matrix(mat, n - 1); } } return val; } }
void ttyout(unsigned char c) { switch(mode) { /* Print mode */ case 5: if(c==6) break; pp(c); return; /* No prefix characters */ case 0: switch(c) { case 6: mode=5; return; /* Pass-thru printing */ case 7: bell(); break; case 8: dowrap=0; bs(); break; case 9: tab(); break; case 10: case 11: case 12: dowrap=0; if(mnl) cr(); lf(); break; case 13: dowrap=0; cr(); break; case 27: mode=1; return; case 0x84: dowrap=0; lf(); break; case 0x85: dowrap=0; cr(); lf(); break; case 0x88: settab(); break; case 0x8d: dowrap=0; ups(); break; case 0x9b: begin(); mode=2; return; default: if(minsert) insc(c); else type(c); } break; /* ESC has been received */ case 1: switch(c) { case 27: return; case '[': begin(); mode=2; return; case 'D': dowrap=0; lf(); break; case 'E': dowrap=0; cr(); lf(); break; case 'H': settab(); break; case 'M': dowrap=0; ups(); break; case '#': mode=3; return; } break; /* ESC [ or 0x9B has been received */ case 2: /* Enter numbers */ switch(c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': parry[nptr]=parry[nptr]*10+c-'0'; return; case ';': if(MAXPARMS== ++nptr) break; else return; case 27: mode=1; return; case '[': begin(); return; case 'c': ttyinit(); break; case 'p': dowrap=0; break; /* Reset what? */ case 'r': dowrap=0; setregn(); break; case 'm': setattrib(); break; case 'J': clrs(); break; case 'K': clrl(); break; case 'X': clrc(); break; case 'H': dowrap=0; pos(); break; case 'C': dowrap=0; right(); break; case 'D': dowrap=0; left(); break; case 'A': dowrap=0; up(); break; case 'B': dowrap=0; down(); break; case 'g': clrt(); break; case 'M': dell(); break; case 'L': insl(); break; case 'P': delc(); break; case '@': inss(); break; case 'h': hmode(); break; case 'l': lmode(); break; case '!': case '?': return; } break; /* ESC # has been received */ case 3: switch(c) { case 27: mode=1; return; case '[': begin(); mode=2; return; } break; } mode=0; }
void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const { FontInfo font = pi.base.font; switch (kind_) { case HYPHENATION: { font.setColor(Color_special); pi.pain.text(x, y, char_type('-'), font); break; } case ALLOWBREAK: { // A small vertical line int const asc = theFontMetrics(pi.base.font).xHeight(); int const desc = theFontMetrics(pi.base.font).descent('g'); int const x0 = x; // x + 1; // FIXME: incline, int const x1 = x; // x - 1; // similar to LibreOffice? int const y0 = y + desc; int const y1 = y - asc / 3; pi.pain.line(x0, y1, x1, y0, Color_special); break; } case LIGATURE_BREAK: { font.setColor(Color_special); pi.pain.text(x, y, char_type('|'), font); break; } case END_OF_SENTENCE: { font.setColor(Color_special); pi.pain.text(x, y, char_type('.'), font); break; } case LDOTS: { font.setColor(Color_special); string ell = ". . . "; docstring dell(ell.begin(), ell.end()); pi.pain.text(x, y, dell, font); break; } case MENU_SEPARATOR: { frontend::FontMetrics const & fm = theFontMetrics(font); // There is a \thinspace on each side of the triangle x += fm.em() / 6; // ▹ U+25B9 WHITE RIGHT-POINTING SMALL TRIANGLE // ◃ U+25C3 WHITE LEFT-POINTING SMALL TRIANGLE char_type const c = pi.ltr_pos ? 0x25B9 : 0x25C3; font.setColor(Color_special); pi.pain.text(x, y, c, font); break; } case SLASH: { font.setColor(Color_special); pi.pain.text(x, y, char_type('/'), font); break; } case NOBREAKDASH: { font.setColor(Color_latex); pi.pain.text(x, y, char_type('-'), font); break; } case PHRASE_LYX: case PHRASE_TEX: case PHRASE_LATEX2E: case PHRASE_LATEX: drawLogo(pi, x, y, kind_); break; } }
void Gen (struct TreAdres *L) { int pocitadlo; char c; while (L->operat!=EOF) { switch (L->operat) { case secti: /* int, real, 3, boolean (id : typ ;)*/ pluss(&L); break; case odecti : minuss(&L); break; case vynasob: nasobb(&L); break; case vydel: dell(&L); break; case porovnej_vetsi: vetsii(&L); break; case porovnej_mensi: mensii(&L); break; case porovnej_vetsi_rovnase: vetsi_rovnoo(&L); break; case porovnej_mensi_rovnase: mensi_rovnoo(&L); break; case porovnej_rovna: rovnoo(&L); break; case porovnej_nerovnase: nerovnoo(&L); break; case prirad: priradd(&L); break; case cti: cti_cisloo(&L); break; case zapis: zapiss(&L); break; case skok_else: skokk(&L); break; case skok_if: skok_kdyzz(&L); break; case konec_while: kon_while(&L); break; case skok_funkce: skok_fun(&L); break; default: GlobalErr ("Internal error: Invalid instruction\n"); } L = L -> ptrr; } return 0; }
void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const { FontInfo font = pi.base.font; switch (kind_) { case HYPHENATION: { font.setColor(Color_special); pi.pain.text(x, y, char_type('-'), font); break; } case LIGATURE_BREAK: { font.setColor(Color_special); pi.pain.text(x, y, char_type('|'), font); break; } case END_OF_SENTENCE: { font.setColor(Color_special); pi.pain.text(x, y, char_type('.'), font); break; } case LDOTS: { font.setColor(Color_special); string ell = ". . . "; docstring dell(ell.begin(), ell.end()); pi.pain.text(x, y, dell, font); break; } case MENU_SEPARATOR: { frontend::FontMetrics const & fm = theFontMetrics(font); // A triangle the width and height of an 'x' int w = fm.width(char_type('x')); int ox = fm.width(char_type(' ')) + x; int h = fm.ascent(char_type('x')); int xp[4], yp[4]; xp[0] = ox; yp[0] = y; xp[1] = ox; yp[1] = y - h; xp[2] = ox + w; yp[2] = y - h/2; xp[3] = ox; yp[3] = y; pi.pain.lines(xp, yp, 4, Color_special); break; } case SLASH: { font.setColor(Color_special); pi.pain.text(x, y, char_type('/'), font); break; } case NOBREAKDASH: { font.setColor(Color_latex); pi.pain.text(x, y, char_type('-'), font); break; } } }