//I have this running but when the user inputs a different character than the program just out puts the error //message and that its. I want it to go back and ask the user if they would like to run the program again. Any //ideas? Thank you!
int main ()
{
double a = 0;
double b = 0;
double c = 0;
double r1 = 0;
double r2 = 0;
char answer;
do
{
try
{
//Greeting
pa7functions::greeting();
//Gets the values of a,b, and c
pa7functions::get_coefficients(a, b, c);
//Figures if a, b, and c are roots
pa7functions::computeRoots(r1, r2, a, b, c);
//Displays the roots
pa7functions::display_roots(r1,r2);
}
catch (matherror& m)
{
m.display();
}
std::cout << "Would you like to run the program again?(y-yes, n-no)\n";
std::cout << "Answer: ";
std::cin >> answer;
if (answer != 'n' || answer != 'N' || answer != 'y' || answer != 'Y')
{
std::cout << "\nPlease enter a character: Y for YES or N for NO.\n";
std::cin.clear();
std::cin.ignore(100);
return EXIT_FAILURE;
}
else
{
return EXIT_SUCCESS;
}
}
while (answer != 'n');
return EXIT_SUCCESS;}