Professional Documents
Culture Documents
Sms
Sms
struct PersonInfo {
int id;
string name;
};
struct Student {
PersonInfo person;
int year;
double gpa;
};
void displayMenu() {
cout << "Menu" << endl;
cout << "1. Input" << endl;
cout << "2. Output" << endl;
cout << "3. Update"<<endl;
cout << "4. Delete"<<endl;
cout << "0. Exit" << endl;
int getChoice() {
int choice;
cout << "Enter choice:";
cin >> choice;
return choice;
}
Student getStudent() {
Student s;
cout << "Enter ID:";
cin >> s.person.id;
cout << "Enter Name:";
cin >> s.person.name;
cout << "Enter Year:";
cin >> s.year;
cout << "Enter GPA:";
cin >> s.gpa;
return s;
}
break;
case EXIT:
exit(0);
default:
cout << "Invalid" << endl;
break;
}
}
int main()
{
const int SIZE = 100;
Student s[SIZE];
int count = 0;
int choice;
do {
displayMenu();
choice=getChoice();
performMenuChoice(choice, s, count);
} while (choice != 0);
return 0;
}