Click here to Skip to main content
15,903,175 members

Comments by GwapoKho (Top 18 by date)

GwapoKho 8-Oct-14 10:36am View    
I tried but still i have a incorrect output when I input a character inputs
char v[100];
while(v!=0&&!cin&&cin.fail())//trap character
{
cout<<"press 0 to go menu: ";
cin.clear(); // clear the error
// clear the input stream
cin.get(v,100);
}
GwapoKho 8-Oct-14 10:20am View    
My program has a logical error it cannot block character inputs.
GwapoKho 8-Oct-14 10:19am View    
this the output of my program when I input a character

press 0 to go menu:press 0 to go menu:
press 0 to go menu:press 0 to go menu:
press 0 to go menu:press 0 to go menu:
press 0 to go menu:press 0 to go menu:
press 0 to go menu:press 0 to go menu:
press 0 to go menu:press 0 to go menu:
press 0 to go menu:press 0 to go menu:
GwapoKho 7-Oct-14 18:47pm View    
I just want to block integer inputs and only accept only character inputs.
GwapoKho 9-Sep-14 7:19am View    
and also I have to trap the input number when the item to be entered is smaller (in value) compared to the last item, the input will be disregarded as it is considered invalid entry.