C++ using namespace std;
Write a program that keeps track of students’ information in a class. The program should use a
structure (name it Students) to store the following data about a student:
name (c string of capacity 81. Name contains a space. You may hardcode 81)
id (integer)
grade (double)
your program should keep an array of students. It should also have the following organization and menu
choices. Use a loop to allow the user to repeatedly choose from the following menu choices:
1) Edit a student
2) View a student’s info
3) Display a count of how many students are in the list .
4) Quit // display “Finished!”
There is no need to create functions, but for each of the menu options:
Edit a student Ask user for an index number and allow entry of all data for a particular student
on that index. Display student’s info in the format of [ID.name grade]
View a Student’s
info Ask user for an index number and display all data of that student. View will only
work for an entry with a real name, not a “-“. Display an error message if there
is a “-“ as name on that index.
Remember to compare using strcmp(student.name, “-“) == 0;
Count how many
students count for names that are not a “-“
again, be sure to use strcmp
Data Storage:
Data should be stored in an array of structures. The array should hold 10 structures.
All elements of the array should be initialized to { “-“, 0, 0}. This will make it easy to determine if a
structure at an index position has been used to store a student's information (see menu option 2 and 3.)
const int SIZE = 10;
Students students[SIZE]......//initialization should be done here
Input Validation:
• For view option (option 2) . Ask user to re-enter an index if there is no student on that index (i.e.
name is “-“)
• User input for index must be between 0-9
• Menu options can only be 1, 2, 3 or 4.
Other Requirements
• Line separator used in the display has 60 ‘*’. Define a string variable name “line” to handle this
task. string line(60, '*');
• Use cin.ignore() between cin>> and getline function
• Name should be a c-string, do not use string
•
•