#include <iostream>
#include <fstream>
usingnamespace std;
int main ()
{
ofstream outfile;
outfile.open("text.txt");
int counter = 1;
int quantity;
string a;
string b;
cout << "how many type a's and type b's?" << endl;
// for this example, just enter 4
cin >> quantity;
cout << "paste type a's and hit enter, then paste type b's and hit enter" << endl;
while (counter <= quantity)
{
cin >> a >> b;
// cin.ignore();
outfile << counter << ")" << endl << "type a:" << endl << a << endl
<< "type b:" << endl << b << endl << endl;
counter = counter + 1;
}
return 0;
}
One line at a time, or one set of multi-line text at a time?
I need the user to paste sets of multi-line texts and it can't be one line at a time unfortunately.
do you notice any "patterns" on it? For example,
"four lines with text, one empty line, then four lines of text"?
Read lines of text and store them to one place until you get an empty line.
Don't store the empty, but continue reading lines of text and store then to another place.