Sorry if I poster a quite similar thread before...
Well, I got to make a program for an exam at the university and I have a little problem... My program should allow you to play the roulette. Everything is fine excpet for a little thing: when you come to put your "budget" (in order to play) and if you insert a letter from the keyboard, my program goes mad... this is the script that (I think) creates the problem:
for(i=0;i<ngiocatori;i++)
{
cout << "Player " << i+1 << ": please, tell us your budget";
cin >> budget;
/* while (budget[i]<=0||budget[i]>30000||cin.fail()||cin.bad())
NOTA: PROTEGGERE DA INPUT NON INTERI. */
while (budget[i]<=0||budget[i]>30000)
{ cout << "You can only insert a budget between 1 and 30000\n";
cout << "Please insert your budget again: ";
cin >> budget[i]; }
}
/* End budget. */
These are the lines, I think. I use the g++ program (Linux) to run the program....
I've proved everything, the [i]cast operation, ordering the program to not accept
char but nothing!
If someone have a suggest, please, answer me here or with Messenger, ICQ, or private mail... I'm desperate!!!!
