Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void justowanie(string &tekst)
- {
- string justed;
- int miejscespacji=0, nrspacji=0, x=0;
- const int MAX=120;
- cout << tekst;
- for(int i=0; i<tekst.length();i++)
- {
- if(i%MAX==0 && i!=0)
- {
- if(tekst[i]==' ')
- justed+="\n";
- else
- {
- justed.replace(miejscespacji,miejscespacji,"\n");
- }
- justed+=tekst[i];
- }
- else
- justed+=tekst[i];
- if(justed[i]==' ')
- miejscespacji=i;
- }
- ofstream zapis;
- zapis.open("wyjustowany.txt");
- zapis << justed;
- zapis.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement