This is a program where a user enters 5 marks, and the program calculates the average mark and grade. However, it should show an error when the user enters a string (alphabet) instead of a number. How do I do this?
#include <iostream>
using namespace std;
int main()
{
double dblMarkOne;
double dblMarkTwo;
double dblMarkThree;
double dblMarkFour;
double dblMarkFive;
double dblAverage;
string strGrade;
cout<<"Enter your first mark: ";
cin>>dblMarkOne;
while (dblMarkOne < 0 || dblMarkOne > 100)
{
cout << "Enter a valid test score within 1 to 100. ";
cout << "Enter your first mark: ";
cin >> dblMarkOne;
}