#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
int main(){
string input = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus tempor libero ut lacus ultrices pellentesque. Donec sed metus in nulla viverra mollis vel nec tellus. Integer vitae nulla diam, dictum iaculis magna. Duis et auctor augue. Etiam vehicula mattis tristique. Nunc rhoncus dolor eu ipsum consectetur ut ornare nunc pellentesque. Nullam accumsan purus nec dui interdum malesuada. Nulla facilisis lacus vitae turpis consequat adipiscing. Integer at venenatis erat. Nulla vitae risus sit amet lorem facilisis volutpat imperdiet quis enim. In. ";
cout << "Your string was " << input.length() << " characters long" << endl;
int breaks = input.length()/80; //Number on new lines it needs
string output;
for(int i=0; i < breaks; i++){
output += input.substr(80*i, 80) + "\n"; //take a string 80 characters long every 80 characters and add a new line after it
}
ofstream file;
file.open("test.txt");
file << output; //print the string with linebreaks to the file test.txt
file.close();
return 0;
}