Author Topic: Simple Question  (Read 4715 times)

tris2006

  • Guest
Simple Question
« on: August 03, 2006, 03:54:46 am »
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";
    }
}
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?
« Last Edit: August 03, 2006, 03:56:54 am by tris2006 »

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Simple Question
« Reply #1 on: August 03, 2006, 04:34:48 am »
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

  • Guest
Re: Simple Question
« Reply #2 on: August 03, 2006, 04:39:01 am »
ah. ok sorry about that. Will try to look into it more.
Thanks anyway.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Simple Question
« Reply #3 on: August 03, 2006, 06:15:07 am »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Simple Question
« Reply #4 on: August 03, 2006, 02:35:51 pm »
If you like forums more, and pose you question properly you can try www.programmingforums.org.

Angel Portal

  • Guest
Re: Simple Question
« Reply #5 on: August 04, 2006, 06:10:06 pm »

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

Angel Portal