Ya i know this code is horribly jumbled, iv been dinkin around with it. Anyway how do you check if a variable is eqal(ornot) to a letter? Also, how do you check say like if a variable is a number, or a letter, or caps, ect.
like isnum, isalhpa, !isnum, ect.
Error:Code:do
{
int input;
char inputl;
cout<<"Which dice do you wish to keep? (Note: Use the dice number, not the number the dice rolled.)\n: ";
cin>>input;
while((input < 1) || (input > 6)){
cout<<"Invalid Number, You Rolled 6 Dice. Please choose a die to keep.\n";
cin>>input;
}
keep[x] = input;
cout<<"Is that all you wish to keep? 'y/n'\n";
cin>>inputl;
while((inputl != n) && (inputl != y)){
cout<<"Invalid.\nIs that all you wish to keep? 'y/n'\n";
cin>>inputl;
}
}while(input != n);
cout<<"Do you wish to Roll Again? y/n\n";
cin>>inputl;
while((inputl != n) && (inputl != y)){
cout<<"Invalid.\nDo you wish to Roll Again? y/n\n";
cin>>inputl;
}
and if i remember right, the bold part is the problem. But theres a couple sections that would cause errors under the 'n' is undeclared thing.Quote:
142 `n' undeclared (first use this function)
142 `y' undeclared (first use this function)
I assume my compiler is looking at "n" and "y" and saying there variables that have not been declared. But how then do i compare a variable to a letter? (char)# ?(where # is the ASCII number for your desired letter)?
Thanks :)