#include <fstream>
#include <iostream>
using namespace std;
int main ()
{
char data[80];
ofstream outfile;
outfile.open("file.txt");
cout << "Writing to the file" << endl;
cout << "Enter your name: ";
cin.getline(data, 80);
outfile << data << endl;
cout << "Enter your id number: ";
cin >> data;
cin.ignore();
outfile << data << endl;
outfile.close();
return 0;
}
|