We've just started I/O streams and i need some help with my prjct.
Here is the lab: "Write a program that gives and takes advice on program writing. The program starts by writing a piece of advice to the screen and asking the user to type a different piece of advice. The program then ends. The next person to run the program receives the advice given by the person who last ran the program. The advice is kept in a file, and the contents of the file change after each run of the program. You can use your editor to enter the initial piece of advice in the file so that the first person who runs the program receives some advice. Allow the user to type in advice of any length so that it can be any number of lines long. The user is told to end is or her advice by pressing the Return key two times. Your program can then test to see that it has reaches the end of the input by checking to see when it reads two consecutive occurrences of the character’\n’."
My code so far
[#include<iostream>
#include<fstream>
using namespace std;
int main(){
char symbol;
ifstream input;
ofstream output;
input.open("input2.txt");
while(!(input.eof())){
input.get(symbol);
cout<<symbol;
}
cout<<endl;
cout<<endl;
cout<<"Enter your advice.\n"
<<"Press enter twice when finished.\n";
do{
cin.get(symbol);
}while(symbol!='\n');
input.close();
system("pause");
}
]
My problem is how to get the input sent to the file, and check if return is hit twice.