Console Menu Version 1.0

Submitted by: 
Visitors have accessed this post 8979 times.

A simple console menu program I wrote in C++ that has an error trapping features to ensure that the user will select the valid options from the menu.

If you have some questions about my work please send me an email at [email protected] People here in the Philippines can reach me in my mobile phone number 09296768375 and 09326639972. My telephone number at home +63 (034) 4335081. Be one of my friends in facebook you can add me my address [email protected]

I am also accepting programming jobs like assignments, projects and thesis in a very reasonable and affordable price. Thank you very much and God Bless.


Mr. Jake Rodriguez Pomperada, MAED - Instructional Technology
Programmer, Teacher, Computer Technician and Electronics Technician

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


need q ng code,,sa add edit,delete,view,save, exit code ..tnx.. cend mu nlng sa ym q..

[email protected]

Plz Help me

t asks us to make a program (using files) that would let a person enter student deatils as follows:

1 > Add student Details
2 > View a student detail
3 > Edit a student's details
4 > Delete a student record
5 > Display all students' grades
6 > Display all students' marks
7 > Display class average and standard deviation
8 > Save a student detail to a file
9 > Exit

I've decided to try to do this problem, step by step (otherwise I get confused), and so I started out with let's say the user picking option 1, to enter student details. Here is my code thusfar.

using namespace std;
int main ()
int user_input_number;
double student_id;
string last_name;
string first_name;
int counter;
int number_of_students;
ofstream student_name("information.dat");

cout << "Welcome to course marks maintenance" << endl;
cout << "Please enter a number corresponding to its function" << endl;
cout << "1 > Add student Details" << endl;
cout << "2 > View a student detail" << endl;
cout << "3 > Edit a student's details" << endl;
cout << "4 > Delete a student record" << endl;
cout << "5 > Display all students' grades" << endl;
cout << "6 > Display all students' marks" << endl;
cout << "7 > Display class average and standard deviation" << endl;
cout << "8 > Save a student detail to a file" << endl;
cout << "9 > Exit" << endl;
cin >> user_input_number;

if (user_input_number == 1)
cout << "You have chosen to add student details" << endl;
cout << "We require you to input 15 details per student" << endl;
cout << "Please tell us how many students' info you are about to enter" << endl;
cin >> number_of_students;
cout << "You are kindly requested to enter every student's name" << endl;

if (student_name.is_open())
for (counter=0; counter<=number_of_students; counter++)
cout << "Enter student last name ==>";
getline (cin, last_name);
student_name << last_name << endl;
cout << "Enter student first name ==>";
getline (cin, first_name);
student_name << first_name << endl;


system ("pause");
return 0;

Simply put, this program was supposed to work like this: if I entered "1", it would ask me to enter student details, and I wrote code till where I could enter student first and last names. I run the program and it does work, but I have a runtime error. I'll show you a sample output of what I got.


when it enters the place where i key in student names (I chose 2 students), if gives this as output

Enter student last name ==> Enter student first name ==>
Enter student last name ==> (i can give input here)
Enter student first name ==> (i can give input here)
Enter student last name ==> (i can give input here)
Enter student first name ==> (i can give input here)

I wanted to ask, why does it initially repeat this line without any prompt of input?

"Enter student last name ==> Enter student first name ==>"

How can I fix it? What would also be a good efficient way for me to finish the rest of my program? Should I use files or should I use arrays and loops instead? Any tips? Sample program? Ofcourse I don't expect you to write it all for me, I just need a 'kick start'

just send it to my email tnx :[email protected]

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th>
  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.