while(cin >> par1 >> par2 >> par3){  // get inputs
cout << par1 << par2 << par3 << endl;

I want to read three inputs with cin,as long as three inputs exist,the loop works good.
But if the user enters two inputs,this time it waits for the next input,
or if the user enters four inputs,it takes first three inputs.

How can I make this input error checking with cin?

I dont want to read a whole line and split it into tokens if there is an acceptable solution? ...

cin as you know will read your input variables separated by spaces. There no way to get cin to do what you want.

You can use getline or you can overload the istream operator and write your own function to parse the input.

Don't forget: std::cin is not alias for a keyboard input. It's an abstract char input stream. You can attach it to a file, for example. Moreover, std::cin is not defined for windowed applications. You describe possible keyboard input errors. But std::cin does not bear a relation to online user behaviour.

This question has already been answered. Start a new discussion instead.