/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <cctype>
#include <limits>
#include <string>
using namespace std;
//This program plots a parabolic function for any choose of variables//
string printheader () //Print the header//
{
cout<<"Please Enter A,B and C for the parabolic function below"<<endl;
cout<<"y=Ax^2+Bx+C"<<endl;
}
int getInt(int x){//check for non-integer input
string theInput;
int inputAsInt;
getline(cin,theInput);
while(cin.fail()||cin.eof()||theInput.find_first_not_of("0123456789")!=std::string::npos){
cout << "Invalid input. Try again: ";
if(theInput.find_first_not_of("0123456789")==std::string::npos){
cin.clear();
cin.ignore(1000,'\n');
}
getline(cin,theInput);
}
std::string::size_type st;
inputAsInt=stoi(theInput,&st);
return x;
}
int CheckInputValu(int y)//To enter variable inputs A,B,C for parablic function
{
int *array=new int;
for (int y=0;y<=2;y++)
{
char NameOfVariable []= "ABC";
cout<<"Please Enter An Integer for Variable"<<endl;
cout<<NameOfVariable[y]<<":";
getInt(array[y]);
}
return y;
}
int main()
{
int FunctionStartHere;
printheader();
CheckInputValu(FunctionStartHere);
return 0;
}