Im using the map function to store student information for an assignment. IN my gradebook.cpp I have it to where you can list the records of students shown. I want it to throw out an error saying there are no records if nothing is currently stored. How would I do this? Or would it be easier to store the information in an array?
//Source.cpp
#include <string>
#include <iostream>
#include "GradeBook.h"
usingnamespace std;
int main()
{
bool valid = true;
char choice;
GradeBook gb;
do
{
cout << "\nWelcome to the Gradebook. To begin select an option from the main menu.\n";
cout << "To add a student enter (A).\n";
cout << "To list all students in the gradebook enter (L).\n";
cout << "To quit the program enter (Q).\n";
cout << "Choice: ";
cin >> choice;
switch (choice)
{
case'A':
gb.addRecord();
break;
case'a':
gb.addRecord();
break;
case'L':
gb.showRecords();
break;
case'l':
gb.showRecords();
break;
case'Q':
exit(1);
case'q':
exit(1);
default:
cout << "That is not a valid option, please choose an option from the list. " << endl;
valid = false;
}
} while (!valid);
system("pause");
return 0;
}