Help Wanted

Help with C++ – buddboy

buddboy

Member

Posts: 2220
From: New Albany, Indiana, U.S.
Registered: 10-08-2004
Can anybody help me with this?

quote:

string szpassword = "1053help";
string szname;
string Ed="Ed";
string nomatter="It doesn't matter. You don't get it!!";
cout<<"Type your first name only and hit enter to see your password Hey you might need to";
cout<<"use an abbreviated name)"<<endl;
cin >> szname;
if(szname=="Ed");
{
cout <<"Your password is:";
cout << szpassword << endl;
}
else;


I get a parse error before the last line.
Anybody know whats wrong?
(thats not all my code just a segment case your wondering [that means you realm master] (lol just kidding RM!)

------------------
In the stock market, you must buy high and sell low...Wait! That's not right!
--------------
Yes, I can be intelligent at times!!

PointOfLight

Member

Posts: 60
From: Indiana, USA
Registered: 11-26-2001
It's been a while for me and C++, but do you really need / want the last else; statement? What was the actual error you recieved?

------------------
Eric Pankoke
http://www.polsoftware.com

Jari

Member

Posts: 1471
From: Helsinki, Finland
Registered: 03-11-2005
There's also a semicolor at the end of the if statement "if(szname=="Ed");"
if you leave it there the execution will always go inside the brackets {} and the if statement has no effect

------------------
For the zeal of thine house hath eaten me up; and the reproaches of them that reproached thee are fallen upon me. - Psa 69:9
He that loveth his life shall lose it; and he that hateth his life in this world shall keep it unto life eternal. - Joh 12:25

[VoHW] (Help needed) [Blog] - Truedisciple (mp3)

buddboy

Member

Posts: 2220
From: New Albany, Indiana, U.S.
Registered: 10-08-2004
Thanks for the help guys...I figured it out... I need the else statement because it's not the end of the C++ document but the end of my post... I get the error before that line... It said that I had a 'parse error before' the last line of my post. I put that it was just a segment!! Ah, well. If anybody wants the whole source in case they need a password remembering program you can have it (just change the values for your name and password and whatever)

------------------
In the stock market, you must buy high and sell low...Wait! That's not right!
--------------
Yes, I can be intelligent at times!!