-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.cpp
135 lines (133 loc) · 2.92 KB
/
database.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
class chareacter
{
public:
char *d;
long long contact;
string name, add, c;
chareacter()
{
// strcpy(name, "xxxxxxxxxxxxxxxxxx");
name = "";
add = "";
// c="";
d = new char;
}
void chare()
{
cout << "\nEnter name of student ";
cin.ignore();
getline(cin, name);
cout << "\nEnter class of student:: ";
cin >> c;
cout << "\nEnter division:: ";
cin >> d;
cout << "\nEnter Contact address:: ";
cin.ignore();
getline(cin, add);
}
~chareacter()
{
delete d;
}
};
class number : public chareacter
{
public:
int roll, dd, mm, yy;
void no()
{
cout << "\nEnter Roll no.:: ";
cin >> roll;
cout << "\nEnter contact number:: ";
cin >> contact;
cout << "\nEnter DOB:: ";
cin >> dd >> mm >> yy;
}
};
class marks
{
int mark;
float per;
public:
void info()
{
cout << "\nEnter 12th marks:: ";
cin >> mark;
cout << "\nEnter 12th percentage:: ";
cin >> per;
}
friend class database;
};
class database : public number, public marks
{
public:
void getdata()
{
chare();
no();
info();
}
void display()
{
cout << "\n1.Name:: " << name;
cout << "\n2.Roll no.:: " << roll;
cout << "\n3.DOB:: " << dd << "-" << mm << "-" << yy;
cout << "\n4.class:: " << c;
cout << "\n5.Division:: " << d;
cout << "\n6.Roll no.:: " << roll;
cout << "\n7.Contact Address :: " << add;
cout << "\n8.Contact no.:: " << contact;
cout<<"\n9.12th mark :: "<<mark;
cout<<"\n10.12th percentage :: "<<per;
}
};
int main()
{
database s[100];
int ch, scount = 0;
do
{
cout << "\n****************DATABASE***************";
cout << "\n1.Add Info";
cout << "\n2.Display Info";
cout << "\n3.EXIT";
cout << "\nEnter choice:: ";
cin >> ch;
switch (ch)
{
case 1:
{
cout << "\n****Add Info****";
s[scount].getdata();
scount++;
break;
}
case 2:
{
cout << "\n****************DATABASE***************";
for (int i = 0; i < scount; i++)
{
s[i].display();
cout << "\n******************************";
}
break;
}
case 3:
{
cout << "\nThank you";
break;
}
default:
{
cout << "\nInvalid Option";
break;
}
}
} while (ch != 3);
getch();
return 0;
}