int build_tree(FILE* database, b_tree** tree){ char* stream; size_t nBytes=120; i_primario* test_index; int counter=0; int read; int lines=linetotal(database); stream=(char*)malloc(sizeof(char)*nBytes); for (counter = 0; counter < lines; counter++){ if (feof(database)) break; fgets(stream, LINEMAX, database); i_create(&test_index, stream, counter + 1); //expose(test_index); insert((tree), test_index); } rewind(database); free(stream); return FUNCTION_OK; }
int main() { int sol; char c; char s[90] = "Presiona 'h' para modo dificil o 'e' para modo facil:\n"; Interface *i; _term_init(); i = i_create(MAXCOLS - 30, MAXROWS - 6, 30, 6, '@', 40, 37, 40, 37, 40, 37); i_drawAll(i); i_drawStr(i, (char *) s, 6, 6, 1); do { c = _read_key(); } while (c != 'h' && c != 'e' && c != 'E' && c != 'H'); if (c == 'e' || c == 'E') sol = miniPadel(i, 0); else sol = miniPadel(i, 1); i_free(i); _term_close(); if (sol == 0) printf("You lose\n"); else if (sol == 1) printf("You win\n"); else printf("Error\n"); return 1; }
int main() { Interface *i; _term_init(); i = i_create(MAXCOLS - 30, MAXROWS - 6, 30, 6, '@', 40, 37, 40, 37, 40, 37); i_drawAll(i); miniRPSLS(i); i_free(i); _term_close(); return 1; }
int main(){ Interface *i; int won; _term_init(); i = i_create(MAXCOLS - 30, MAXROWS - 6, 30, 6, '@', 40, 37, 40, 37, 40, 37); if(!i) return -1; i_drawAll(i); won = questions(i); sleep(2); i_free(i); _term_close(); return won; }
int main(){ int k, j; Interface *i; int it = 0; char **txt = (char **)malloc(11 * sizeof(char *)); for(k = 0; k < 11; k++){ txt[k] = (char *) malloc(10 * sizeof(char)); } txt[0] = "2.txt"; txt[1] = "4.txt"; txt[2] = "8.txt"; txt[3] = "16.txt"; txt[4] = "32.txt"; txt[5] = "64.txt"; txt[6] = "128.txt"; txt[7] = "256.txt"; txt[8] = "512.txt"; txt[9] = "1024.txt"; txt[10] = "2048.txt"; _term_init(); i = i_create(MAXCOLS - 30, MAXROWS - 6, 30, 6, '@', 40, 37, 40, 37, 40, 37); i_drawAll(i); sleep(2); i_readFile(i, "board2048.txt", 0, 0, 1); sleep(2); for(k = 0; k < 4; k++){ for(j = 0; j < 4; j++){ i_readFile(i, txt[it], 4 + k*7, 17 + j*18, 1); sleep(1); it++; } } sleep(5); i_free(i); _term_close(); return 0; }