bool BingoGame::imprimir_cartones(const char* template_name) { std::string str; std::ofstream index_file; std::string temp_name(template_name); name = temp_name.substr(0, temp_name.length() - 4); index_file.open((name + ".idx").c_str()); if ( ! index_file ) { std::cerr << "toc: could not create index document" << std::endl; return false; } index_file << numero_cartones << std::endl; std::vector < std::string > temp(25); for (size_t i = 0; i < numero_cartones ; ++i) { card_shuffle(); str = ""; str = name + "-" + std::to_string(i) + ".svg"; Carton nuevo(words); if ( ! nuevo.imprimir_carta(template_name, str.c_str(), i) ) { std::cerr << "toc: could not print document(clase bingo)" << std::endl; return false; } nuevo.copiar_vector(temp); index_file << std::to_string(i) << std::endl; for (int j = 0; j < 25; ++j) index_file << temp[j] << std::endl; index_file << std::endl; } index_file.close(); //std::cerr << "se imprimio carton" << std::endl; return true; }
int main() { initwindow( 800,600 ); settextstyle(2,0,4); loading(); settextstyle( 11, 0, 10); int op, code, multi; page p; do { switch( op = menu() ) { case 1: putimage( 0, 0, imagen, COPY_PUT ); nuevo(); cleardevice(); break; case 3: putimage( 0, 0, imagen, COPY_PUT ); p = listar(0); code = p.code; multi = p.multi; if( code >= 2 && code < 15 ){ cleardevice(); editar( code-2 + (13*multi) ); }else if( code >= 15 ){ cleardevice(); borrar( code-15 + (13*multi), FILE_NAME ); } cleardevice(); break; case 2: putimage( 0, 0, imagen, COPY_PUT ); code = encontrar(); if( code == 0 ) { FILE_NAME = "find.$$$"; putimage( 0, 0, imagen, COPY_PUT ); p = listar(0); code = p.code; multi = p.multi; if( code >= 2 && code < 15 ){ cleardevice(); editar( code-2 + (13*multi) ); }else if( code >= 15 ){ cleardevice(); borrar( code-15 + (13*multi), FILE_NAME ); } system( "del find.$$$" ); FILE_NAME = "agenda.dat"; } cleardevice(); break; default : exit(0); printf("Opcion no valida"); break; } }while(1); return 0; }