[C++] Coding help

Newbie Spellweaver
Joined
Jul 21, 2008
Messages
5
Reaction score
0
I need help with C++ coding. I know some code cuz I took Intro C++ for summer camp this year. It's a little hard to explain what I'm trying to do. I wanna make it like an if statement for the WHOLE thing. :/ Like you put in yourCommand and whenever yourCommand is == "help" it'll cout<<"Help: "; (w/e just an example.) The stupid programming counselor at the summer camp wouldn't help me with it cuz he would rather have helped some kid in 3d game creation ;O
 
If I understood it right..

Code:
if(yourCommand == "help") 
{
cout << "help" << endl;
}

Well kind of cept I know how to do that :/ Thanks for posting though I appreciate it. Anyways like... when I type in my code in a new document, it reads the page from the top to bottom. But I want it to ALYWAYS do the if statement no matter where it is in the code.
Like if I put:
Code:
cin>>yourCommand;
system("PAUSE");
system("cls");
cin>>yourCommand;
system("PAUSE");
system("cls");
I want it to print out whats in here:
Code:
if(yourCommand=="help")
{
cout<<"It worked?"<<endl;
}
Basically do the if statement for each code without putting it after each of the sections. It's hard to to explain :/
 
The solution to your problem is extremely simple, maybe you should start reading a book or two on C before even trying to attempt writing an application in a language you know pretty much nothing about. You obviously haven't even scraped the surface of C++ from that intro, and if it was for more than a day, it was a waste of time.

I will not give you the answer to your problem, nor do I think anyone else should. You need to study on your own, or take some classes. Programming is about problem solving, so if you can't solve this by yourself, you might as well not bother with programming at all.
 
Back