-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc.cpp
More file actions
41 lines (36 loc) · 692 Bytes
/
Copy pathc.cpp
File metadata and controls
41 lines (36 loc) · 692 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
#include <iostream>
#include <fstream>
using namespace std;
struct studjg{
string s;
}ss[2];
class student
{
public:
int getData()
{
for(int i=0;i<2;i++){
cout<<"Enter name:"; cin>>ss[i].s;
}
}
int showData()
{
for(int i=0;i<2;i++){
cout<<"Name:"<<ss[i].s<<endl;
}}
};
int main()
{
student s;
//fstream file;
ofstream file;
file.open("x3.txt",ios::out);
s.getData();
//file.write((char*)&s,sizeof(s));
file.close();
ifstream file1;
file1.open("x3.txt",ios::in);
//file1.read((char*)&s,sizeof(s));
s.showData();
file1.close();
}