Raised This Month: $ Target: $400
 0% 

C++ Gaben test [Done]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zenith77
Veteran Member
Join Date: Aug 2005
Old 02-14-2007 , 22:00   Re: C++ help
Reply With Quote #1

You probably have a logic error (I'm to lazy to look for it right now). But you still need to do the while loop thing.

Quote:
Originally Posted by LittleDude View Post
you gotta return 0 back to the calling program so it knows to end.
That's his problem, he doesn't want it to end. And no, you don't have to return 0 or return anything for that matter (hence return type void), as most compilers know how to handle this.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 02-14-2007 , 22:03   Re: C++ help
Reply With Quote #2

Quote:
Originally Posted by Zenith77 View Post
You probably have a logic error (I'm to lazy to look for it right now). But you still need to do the while loop thing.



That's his problem, he doesn't want it to end. And no, you don't have to return 0 or return anything for that matter (hence return type void), as most compilers know how to handle this.
could you explain exactly what the loop is doing.. (im fairly new to C++) havent got to loops yet..
__________________
i stop around here and there.
Da_sk8rboy is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 02-14-2007 , 22:22   Re: C++ help
Reply With Quote #3

Quote:
Originally Posted by Da_sk8rboy View Post
could you explain exactly what the loop is doing.. (im fairly new to C++) havent got to loops yet..
Well, you should probably know that main is, by name, your main function. It's the control center of your program. And once that function ends, you're done. So, what if you want to continually do an action? The way to do this is an a for/while loop. FYI, loops are pretty much the same as they are in pawn (for the most part).

Code:
void main(void)
{
    bool quit = false; // Don't forget you _must_ initiliaze variables in C++. Or
                           // you'll get an error or a program crash.
    while (!quit)
    {
          // Let's say we're running a game.
          gMyEngine->UpdateGraphics();
          gMyEngine->ClearServerMessages();
          // etc.

         if (!Blabla())
             quit = true; // Stop execution
    }

     // Do ending stuff right here.
     gMyEngine->ClearMemory();
}
There are some other ways you can do this to:

Code:
while (1)
{ 
     if (yar)
         break;
}
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred

Last edited by Zenith77; 02-14-2007 at 22:25.
Zenith77 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode