Error Trapping

Windows 7, Visual Studio 2010:

Simple program to add two numbers (haven't coded in a while!):

#include "stdafx.h"; #include<iostream>;#include<math>; using namespace std;

int main(){
float x,y;

do{
cout<<endl;
cout<<"please enter a number greater that 3 and less than 9 ";cin>>x;
if (x<3 || x>9)
cout<< "ERROR"<<endl;
)while(x<3 || x>9);

etc...}

More code for cin>>y;

Code works just fine for any number for x and y.
However, if x or y entered as an ALPHA character, all goes kapoot.
Need code to give ERROR message for ALPHA input.

Thanks
Doc
Topic archived. No new replies allowed.