-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
101 lines (78 loc) · 2.06 KB
/
Copy pathmain.cpp
File metadata and controls
101 lines (78 loc) · 2.06 KB
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
#include<iostream>
#include<string>
#include<stdbool.h>
#include "student.h"
using namespace std;
int choice = 0;
bool firstTime=true;
void choiceTaking(){
if(firstTime){
cout << "STUDENT MANAGEMENT PROGRAM" << endl;
cout << "1.Enter stundet data." << endl;
cout << "2.Display student data." << endl;
cout << "3.Exit." << endl;
cout << "\nEnter your choice: ";
cin >> choice;
}else{
cout << "\n1.Enter stundet data." << endl;
cout << "2.Display student data." << endl;
cout << "3.Exit." << endl;
cout << "\nEnter your choice: ";
cin >> choice;
}
}
int main(){
struct student s;
bool isDataEntered=false;
bool iscorrectinput = false;
bool isExit = false;
while(!iscorrectinput){
choiceTaking();
if(choice==1 || choice==2 || choice==3){
iscorrectinput = true;
}else{
cout << "Invalid input please \n enter the correct input." << endl;
iscorrectinput = false;
}
}
while (!isExit)
{
switch (choice)
{
case 1:
inputStudentData(&s);
isDataEntered=true;
firstTime=false;
break;
case 2:
if(isDataEntered==true){
displayReportCArd(&s);
}else{
cout<<"\n[Error] No data found! Please enter student data first."<<endl;
}
firstTime=false;
break;
case 3:
exit();
isExit = true;
break;
}
while(1){
string temp="\0";
cout<<"Do you want continue enter [yes/no] : ";
cin>>temp;
if(temp=="yes" || temp=="Yes"|| temp=="YES"){
choiceTaking();
firstTime=false;
break;
}else if(temp=="no" || temp=="No" || temp=="NO"){
exit();
isExit=true;
break;
}else{
cout<<"Invalid input !"<<endl;
}
}
}
return 0;
}