-
Notifications
You must be signed in to change notification settings - Fork 2
/
show.cpp
57 lines (49 loc) · 1.07 KB
/
show.cpp
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
50
51
52
53
54
55
56
57
#include<bits/stdc++.h>
#include<fstream>
#include<cstdio>
#include<string.h>
#include "show.h"
using namespace std;
class person
{
int age;
char gender,prof[50],locality[50];
public:
void setData()
{
cout << "\nEnter your age ";
cin >> age;
cout << "Enter your Gender(M,m/F,f) : ";
cin>>gender;
cout<<"Enter your Profession : ";
cin>>prof;
cout<<"Enter your locality : ";
cin>>locality;
}
void showData()
{
cout << "\nAge : " << age;
cout << "\nGender : " << gender;
cout << "\nProfession : " << prof;
cout << "\nlocality : " << locality;
}
string local()
{
return locality;
}
};
void display()
{
getchar();
system("clear");
ifstream inFile;
inFile.open("h.dat", ios::binary);
person obj;
cout<<"\n";
while(inFile.read((char*)&obj, sizeof(obj)))
{
obj.showData();
cout<<"\n";
}
inFile.close();
}