Computing.Net > Forums > Programming > c++ help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

c++ help

Reply to Message Icon

Name: suzie82
Date: February 27, 2005 at 17:20:10 Pacific
OS: XP
CPU/Ram: 512
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: February 27, 2005 at 20:05:16 Pacific
Reply:

"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


0

Response Number 2
Name: HiJinx
Date: February 27, 2005 at 21:27:54 Pacific
Reply:

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.


0

Response Number 3
Name: BlueRaja
Date: February 27, 2005 at 22:55:37 Pacific
Reply:

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


0

Response Number 4
Name: Plutonium123
Date: March 15, 2005 at 16:59:57 Pacific
Reply:

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


0

Response Number 5
Name: BlueRaja
Date: March 15, 2005 at 20:14:19 Pacific
Reply:

Please post in a seperate thread...

And the reason it's not working is because that's not C.

BlueRaja.admin@gmail.com


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Php assistance Letting Ghost search for ...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: c++ help

Simple C Help!!! www.computing.net/answers/programming/simple-c-help/9795.html

C# help www.computing.net/answers/programming/c-help/3176.html

help help!!!..C...data file..please www.computing.net/answers/programming/help-helpcdata-fileplease/8092.html