User forums > Using Code::Blocks

Simple Question

(1/2) > >>

tris2006:
Ok im a noob to C++ programming and this is my first post here. So dont flame me too bad if this seems like a dumb question. :P
Just to tell you how big a noob I am, I just got out of the hello world phase a little while ago. ;) Anyway heres my question.
I am trying to make some kind of very simple command prompt thingy. Heres some code:

--- Code: ---{
    char name[25];

    cout<<"Welcome\n";
    cout<<"\n->";
    cin.getline ( name, 25 );

    if ( strcmp ( name, "test" ) == 0 )
    {
        cout<<"Test completed. System working normally.\n";
    }
    if ( strcmp ( name, "help" ) == 0 )
    {
        cout<<"List of commands:\n";
        cout<<"test,help";
    }
}
--- End code ---
how would I make the program jump back to the starting point after the end of every if statement instead of returning 0 and ending?

Ceniza:
Sorry but we don't answer programming questions unrelated to Code::Blocks itself, and posting in "Using Code::Blocks" has nothing to do with it... really.

Unfortunately I don't know a place to point you to so you can ask there.

I'll just give you an advice: read from a good tutorial or book everything related to loops... and try to find a good forum for programming questions :wink:

BTW... don't you wonder if this thread is deleted by an administrator in a few hours :D

tris2006:
ah. ok sorry about that. Will try to look into it more.
Thanks anyway.

MortenMacFly:
To get a good answer to your question(s) - and maybe even the best - I recommend posting C/C++ related questions into newsgroups like comp.lang.c and comp.lang.c++.
With regards, Morten.

Game_Ender:
If you like forums more, and pose you question properly you can try www.programmingforums.org.

Navigation

[0] Message Index

[#] Next page

Go to full version