News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Simple Question

Started by tris2006, August 03, 2006, 03:54:46 AM

Previous topic - Next topic

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:
{
    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";
    }
}

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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Game_Ender

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

Angel Portal


I also like this american magazine.
http://www.ddj.com/
It has some good news about programming world.

Angel Portal