C
Card.Meep
Guest
Ok:
And when I run it, it works the first time but when it repeats it doesn't ask for input.
What would you like to add to the file?
LOL NOTES
Saved: LOL NOTES to c:/notes.txt!
Would you like to add more? (1 == yes) (2 == no)
1
What would you like to add to the file?
Saved: to c:/notes.txt!
Would you like to add more? (1 == yes) (2 == no)
Bolded the problem. It goes through that without a pause. Please help? :]
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int write() {
string file;
int q;
cout << "What would you like to add to the file? \n" << endl;
getline (cin,file);
ofstream myfile;
myfile.open ("c:/notes.txt");
myfile << file;
myfile.close();
cout << "Saved: " << file << " to c:/notes.txt!" << endl;
cout << "Would you like to add more? (1 == yes) (2 == no)" << endl;
cin >> q;
if (q == 1) {
write();
}
}
int main () {
write();
cin.clear();
cin.ignore(255, '\\n');
cin.get();
return 0;
And when I run it, it works the first time but when it repeats it doesn't ask for input.
What would you like to add to the file?
LOL NOTES
Saved: LOL NOTES to c:/notes.txt!
Would you like to add more? (1 == yes) (2 == no)
1
What would you like to add to the file?
Saved: to c:/notes.txt!
Would you like to add more? (1 == yes) (2 == no)
Bolded the problem. It goes through that without a pause. Please help? :]













