how to check if input is integer ?

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