Hi. I have an assignment to do..i have done it..but i need to do one more thing. Things sound like this:
user inputs 6 integers
program needs to check them if there are integer if not it has to output a message for the user
if the input is integer it has to go further and work with the input
any guideliness?
i have used this structure :
if ( ! ( cin >> temp ) )
{
cout<<"Input is not integer.This program will end ! "<<endl<<endl<<endl;
system("pause");
return 0;
}
where i declared temp as being int since i started
the problem is after it gets the last input still waits for an input
i will attach the source code if needed.
thank you all in advance
thank you for your help but I need to implement it in my source code
#include<iostream>
using namespace std;
int main()
{
double a_one,a_two,b_one,b_two,c_one,c_two; // we allocate space in the memory for the values that user has to input
double x,y,d,d_x,d_y;
cout<<" input a_one"<<endl;
cin >>a_one;
cout<<" input b_one"<<endl;
cin>>b_one;
cout<<" input c_one"<<endl;
cin>>c_one;
cout<<" input a_two"<<endl;
cin>>a_two;
cout<<" input b_two"<<endl;
cin>>b_two;
cout<<" input c_two"<<endl;
cin>>c_two;
cout<<"Now to calculate the solutions for you !"<<endl<<endl;
if ((a_one*b_two)!=(a_two*b_one))
{
d=a_one*b_two-a_two*b_one; //we calculate the determinant
cout<<" The solutions are : "<<endl<<endl;
cout<<"x="<<x<<endl<<endl;
cout<<"y="<<y<<endl<<endl;
}
else
cout<<"d=0 . I can't go further"<<endl;
system("pause");
return 0;
}
I need to verify the input . if the input is double or integer then the program should work. if not it needs to ask the user to input the corect value and then i need the program to use it.