At the moment I have a menu displaying four choices (1. exit, 2. statistics, 3. find mark, 4. display mark). If the user types anything else apart from 0-3, then an error message will be displayed. I somehow cannot get the error message to display properly when a user types in a letter (a,b,c), instead, it just continuously displays the error message (never-ending loop). Here is what my code looks like:
#include <iostream>
using namespace std;
int main()
{
int menu;
string studentID[] = {"P1001", "P1002"};
float studentMark[] = {78.50, 66};
int i;
int j;
int totalStudents=0;
float totalMarks=0;
float averageMark;