Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
i am working on a program for a class and it keeps giving me errors that i've never had before. i don't think there's a reason it should give these errors. this is the part giving me errors:
while (user_variable != 35)
if (user_variable >= 65)&&(user_variable <= 90)
uppercase_letter++;
else if(user_variable>=97)&&(user_variable<= 122)
lowercase_letter++ ;
else if (user_variable>=48)&&(user_variable<= 57)
number++;
do{
cout << "The Number of characters in each group is\n"
<< "Lowercase : "<< lowercase_letter << endl
<< "Uppercase : "<< uppercase_letter << endl
<< "Numbers : " << number << endl
<< "\n Would you like to continue? (y/n) \n";}while (choice=='Y')||(choice=='y')
the compiler gives these errors :syntax error before `user_variable' , syntax error before `||' token
all appropriate variables have been declared

"i don't think there's a reason it should give these errors"
So, why do you think that the compiler is giving errors? It's having a bad day? It doesn't like your makeup?
Change
if (user_variable >= 65)&&(user_variable <= 90)
to
if ((user_variable >= 65)&&(user_variable <= 90))
The while part of your do-while has the same problem

You also need a semicolon with the do/while, ie:
do
{
...
}
while(condition);Two small notes... there's no way out of your while loop once you get into it, and you need a cinn to get user input in the do/while.

You know, the compiler will translate single characters (such as 'a' or 'A') into ASCII for you, so that your code isn't so cryptic...
BlueRaja.admin@gmail.com

Hi boys i am haveing a hard time witrh a game i am codeing lol i geet getting "syntax error before '/" token" on the first line of this code
area/ stuff
longway
Entered()
if(usr.dir == EAST)
usr

Please post in a seperate thread...
And the reason it's not working is because that's not C.
BlueRaja.admin@gmail.com

![]() |
Php assistance
|
Letting Ghost search for ...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |