#include #include #include #include #include "Conjunto.h" #include "Processor.h" /////////////////////////////////////////////////////////////////////////////////////////////////////// // FUNCIONES /////////////////////////////////////////////////////////////////////////////////////////////////////// void manejo(ifstream & infile) { ///////////////////////////////////////////////////////MATRIZ DONDE GUARDO LOS CONJUNTOS DEL ARCHIVO char MAT_CONJ[100][100];// defino matriz para guardar los caractres de los conjuntos int in_lin_mat_conj=0; int in_col_mat_conj=0; int number=0; int cuenta=0; Conjunto ARR_CONJ[100];//defino arreglo de conjuntos infile >> MAT_CONJ[0];//meto a mi matriz la primera linea del archivo while('%' != MAT_CONJ[in_lin_mat_conj][0]) { in_col_mat_conj=0; while('{' != MAT_CONJ[in_lin_mat_conj][in_col_mat_conj]) { in_col_mat_conj++; } in_col_mat_conj++; while('}' != MAT_CONJ[in_lin_mat_conj][in_col_mat_conj]) { number=0; if((MAT_CONJ[in_lin_mat_conj][in_col_mat_conj]<'0')||(MAT_CONJ[in_lin_mat_conj][in_col_mat_conj]>'9')) { in_col_mat_conj++; } else { while((MAT_CONJ[in_lin_mat_conj][in_col_mat_conj]>='0')&&(MAT_CONJ[in_lin_mat_conj][in_col_mat_conj]<='9')) { number=number*10+MAT_CONJ[in_lin_mat_conj][in_col_mat_conj]-'0'; in_col_mat_conj++; } ARR_CONJ[in_lin_mat_conj].agrega(number); } } in_lin_mat_conj++; infile >> MAT_CONJ[in_lin_mat_conj]; } ///////////////// lleno con las definiciones de los conjuntos del archivo mi matriz de caracteres ///////////////////////////////////////////////////MATRIZ DONDE GUARDO LAS OPERACIONES DEL ARCHIVO int i=0; char MAT_OPERACIONES[100][100];//defino matriz de operaciones string STR_RESP;//defino string de respuestas infile>>MAT_OPERACIONES[i]; while(!infile.eof()) { cout<<"CONJUNTOS:"<<"\n"<'9')) { w++; } else { while((STR_RESP[w]>='0')&&(STR_RESP[w]<='9')) { k=k*10+STR_RESP[w]-'0'; w++; } temp.agrega(k); } } cout<<"El resultado correcto es el siguiente:\n"<>MAT_OPERACIONES[i]; } double porcentage_exito; porcentage_exito=100*cuenta/i; cout<<"el numero de repuestas correctas fue: "<='A')&&(test[z1]<='Z'))); int r2=(((test[z1+1]>='A')&&(test[z1+1]<='Z'))||(test[z1+1]=='(')); if((r1&&r2)==1) { cout<<"Error, operacion ausente entre un cierre o apertura de parentesis y un conjunto en la linea "<>ayuda; if(ayuda[0]==l)//detecta la linea de separacion entre conjuntos y operaciones// goto cuenta; } cuenta:; while(!arch.eof()) { arch>>ayuda;//cuenta lineas con operaciones// i++; } return i; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // MAIN ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int main (int argc, char * argv[]) { if((argc!=2)&&(argc!=3)) { cerr << "ERROR "<< "Número de argumentos invalidos en la linea de comandos\n" << endl; return 1; } if(argc==2) { ifstream fin; fin.open(argv[1]); manejo(fin); fin.close(); } else if((argc==3)) { cout<<'\n'<<"Iniciando revision de sintaxis..."<<'\n'<>basura; } for(int z=0;z>operaciones; while(operaciones[k]!='i') { k++; } i++; runtest(operaciones, i, k); } cout<<"Revision de sintaxis completada."<