-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathass_4.cpp
More file actions
50 lines (31 loc) · 845 Bytes
/
Copy pathass_4.cpp
File metadata and controls
50 lines (31 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <fstream>
#include <iostream>
using namespace std;
int main() {
char data[100];
string line;
ofstream outfile;
outfile.open("data1.txt");
cout << "..............Writing to the file..........." << endl;
cout << "Enter Your name:" << endl;
cin.getline(data, 100);
outfile << data << endl;
cout << "Enter Your age:" << endl;
cin >> data;
cin.ignore();
outfile << data << endl;
outfile.close();
ifstream infile;
infile.open("data1.txt");
cout << "*************Reading from the file:*****************" << endl;
/*infile >> data;
cout << data << endl;
infile >> data;
cout << data << endl;
*/
while (getline(infile, line)) {
cout << line << endl;
}
infile.close();
return 0;
}