-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinsert.cpp
51 lines (43 loc) · 1.04 KB
/
insert.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
#include<bits/stdc++.h>
#include<fstream>
#include<cstdio>
#include<string.h>
#include "insert.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/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 write_record()
{
ofstream outFile;
outFile.open("h.dat", ios::binary | ios::app);
person obj;
obj.setData();
outFile.write((char*)&obj, sizeof(obj));
outFile.close();
};