menu option

Write your question here.This is my sample program using structure for students records,it runs okay.now my teacher ask us to put menu option in the structure but i dont know how to start


For example:
1]ADD
2]DELETE
3]EDIT
4]QUIT TEXT
5]DISPLAY

[code]
Put the code you need help with here.
[/code


#include <iostream>
#include "conio.h"
using namespace std;

struct name
{
char fname[50];
char mname[50];
char lname[50];
};

struct contact
{
char email[50];
char cellno[50];
int landline;
};

struct subject
{
name n;
contact c;
float mathp;
float mathm;
float mathf;
float engp;
float engm;
float engf;
float scip;
float scim;
float scif;
float hisp;
float hism;
float hisf;
float pep;
float pem;
float pef;
};

void main()
{
int i;
subject set[] = {{"Denver", "Dela Cruz", "DELA CRUZ", "denver.DELACRUZ24@gmail.com", "09061093689", 8700011, 3.0, 3.5, 3.2, 3.5, 2.5, 3.1, 3.4, 3.5, 3.5, 3.4, 3.0, 3.0, 2.5, 2.4, 1.5},
{"Jackielyn", "Chua", "Becher", "jackie.chua55@gmail.com", "09064553689", 1234123, 2.5, 2.6, 2.3, 2.0, 2.6, 2.3, 2.6, 1.9, 1.9, 2.0, 2.5, 2.0, 2.6, 1.9, 1.8},
{"Donah", "Big", "Brown", "donah.brown56@gmail.com", "09305572144", 1593574, 1.5, 1.5, 1.5, 2.1, 1.9, 1.8, 2.1, 1.9, 1.5, 2.5, 2.4, 1.8, 2.0, 1.5, 1.5},
{"John", "Bone", "Jones", "bone.thugs99@gmail.com", "09126783535", 2486312, 3.5, 3.6, 3.7, 3.8, 3.7, 3.5, 3.4, 3.3, 3.2, 3.0, 3.5, 3.5, 3.4, 3.6, 3.5},
{"Tom", "Cruz", "Jones", "tom.cruz_jones@yahoo.com", "03125693556", 9689687, 1.9, 1.9, 1.8, 1.5, 1.0, 1.0, 1.5, 1.9, 1.8, 1.7, 1.5, 1.6, 1.5, 1.5, 1.0}};
system ("cls");

cout << "Student Record\n" << endl;
for (i = 0; i < 5; i++)
{
cout << "Student Name: " << set[i].n.fname << " " << set[i].n.mname << " " << set[i].n.lname << endl;
cout << "Email address: " << set[i].c.email << endl;
cout << "Cellphone number: " << set[i].c.cellno << endl;
cout << "Landline number: " << set[i].c.landline << endl;
cout << "Grades in Math(Prelim/Midterm/Final term): " << set[i].mathp << " " << set[i].mathm << " " << set[i].mathf << endl;
cout << "Grades in English(Prelim/Midterm/Final term): " << set[i].engp << " " << set[i].engm << " " << set[i].engf << endl;
cout << "Grades in Science(Prelim/Midterm/Final term): " << set[i].scip << " " << set[i].scim << " " << set[i].scif << endl;
cout << "Grades in History(Prelim/Midterm/Final term): " << set[i].hisp << " " << set[i].hism << " " << set[i].hisf << endl;
cout << "Grades in PE(Prelim/Midterm/Final term): " << set[i].pep << " " << set[i].pem << " " << set[i].pef << endl;
cout << endl;
}

_getch();
}
Hi,
Firstly :
void main()

Should be :
int main()
its so hard to put a menu option in there
1
2
3
4
5
6
7
8
9
10
11
12
system ("cls");
int choice;
cout << "1]ADD\n"
"2]DELETE\n"
"3]EDIT\n"
"4]QUIT\n"
"5]DISPLAY\n"
"Your choice : ";
cin >> choice;
cout << "The choice you entered : " << choice << endl;

return 0;


You can start from here.
Topic archived. No new replies allowed.