-
Notifications
You must be signed in to change notification settings - Fork 0
/
StudentData_ver1.cpp
80 lines (77 loc) · 2.27 KB
/
StudentData_ver1.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
#include <iostream>
#include <string.h>
using namespace std;
struct mahasiswa
{
string name;
int age;
float gpa;
};
mahasiswa data[1000];
int main()
{
int menu,input,inp,a,b,c;
top:
cout << "Menu" << endl;
cout << "1. Add student data" << endl;
cout << "2. Edit student data" << endl;
cout << "3. View student data" << endl;
cout << "4. Exit" << endl;
cout << "========================\n";
cout << "Menu ";
cin >> menu;
switch(menu)
{
case 1:
cout << "How much data would you like to input? ";
cin >> input;
for(a=0;a<input;a++)
{
cout << "Name= ";
cin >> data[a].name;
cout << "Age = ";
cin >> data[a].age;
cout << "IPK = ";
cin >> data[a].gpa;
cout << "========================\n";
}
system("pause");
cout << endl;
goto top;
case 2:
cout << "Which data would you like to change? ";
cin >> input;
input=input-1;
cout << "Existing data\n";
cout << "Name= " << data[input].name << endl;
cout << "Age = " << data[input].age << endl;
cout << "IPK = " << data[input].gpa << endl;
cout << "========================\n";
cout << "New data\n";
cout << "Name= ";
cin >> data[input].name;
cout << "Age = ";
cin >> data[input].age;
cout << "IPK = ";
cin >> data[input].gpa;
system("pause");
cout << endl;
goto top;
case 3:
cout << "Which data would you like to see? ";
cin >> input;
c=input-1;
cout << "Data " << input << endl;
cout << "Name= " << data[c].name << endl;
cout << "Age = " << data[c].age << endl;
cout << "IPK = " << data[c].gpa << endl;
cout << "========================\n";
system("pause");
cout << endl;
goto top;
default:
break;
}
system("pause");
return 0;
}