Eccovi il codice definitivo con cui ho risolto il problema devo dire che alla fine non era cosi difficile e a grazie al sito http://www.cplusplus.com/reference/ non ci sono stato tanto, c'è davvero tutto.codice:#include <cstdlib> #include <iostream> #include <fstream> #include <string> #include <sstream> using namespace std; int main () { char o_letter[17]; string n_letter[17]; {o_letter[0]='b'; o_letter[1]='c'; o_letter[2]='e'; o_letter[3]='h'; o_letter[4]='i'; o_letter[5]='j'; o_letter[6]='k'; o_letter[7]='m'; o_letter[8]='o'; o_letter[9]='p'; o_letter[10]='r'; o_letter[11]='s'; o_letter[12]='u'; o_letter[13]='v'; o_letter[14]='w'; o_letter[15]='x'; o_letter[16]='y'; } {n_letter[0]="Ь"; n_letter[1]="с"; n_letter[2]="ө"; n_letter[3]="һ"; n_letter[4]="і"; n_letter[5]="ј"; n_letter[6]="ĸ"; n_letter[7]="м"; n_letter[8]="ο"; n_letter[9]="р"; n_letter[10]="г"; n_letter[11]="ѕ"; n_letter[12]="υ"; n_letter[13]="ν"; n_letter[14]="ω"; n_letter[15]="х"; n_letter[16]="ү"; } ifstream ingr ; ofstream usc ; ingr.open( "source.txt", ios::in); if (ingr.fail()) exit(-1); usc.open("dest.txt", ios::out); if (usc.fail()) exit(-1); usc<<"<p style=\"text-align: justify;\"><font face=\"Arial\">"; string str; size_t found; while (!ingr.eof()){ stringstream paragrafo; getline(ingr, str); paragrafo << str; if (ingr.bad()) exit(-1); while (!paragrafo.eof()){ paragrafo >> str; unsigned int sostituzioni, max_sosti; if (str.length()<=2) max_sosti=1; else max_sosti=2; sostituzioni=0; do{ found=string::npos; int i=0; for(; (i<17)&&(found==string::npos); i++) found=str.find(o_letter[i]); if (found!=string::npos) {str.replace(found,1,n_letter[i-1]); sostituzioni++; } else break; }while(sostituzioni<max_sosti); usc<<str<<" "; } usc<<"</font></p>"<< endl; usc<<"<p style=\"text-align: justify;\"><font face=\"Arial\">"; } usc<<"</font></p>"<<endl; usc<<"<p style=\"text-align: justify;\"></p>"<<endl; usc<<"<p style=\"text-align: justify;\">fonte: xxxxx.it</p>"<<endl; usc<<"<p style=\"text-align: justify;\"></p>"<<endl; ingr.close(); usc.close(); return 0; }
Mi scuso per il titolo poco esaustivo, devo scrivere Risolto adesso?

 
			
			 
			 
					
					
					
						 Rispondi quotando
  Rispondi quotando