Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Hello world execution problems

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
C-Dizzle
Grandmaster Cheater
Reputation: 89

Joined: 16 Mar 2008
Posts: 623

PostPosted: Thu Mar 18, 2010 12:12 pm    Post subject: Hello world execution problems Reply with quote

So I am just recently starting to learn C++. The problem I am having (Probably nooby) Is that when I click execute it just flashes on screen then disappears.
Sorry if this is a noob question, but thanks in advanced.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu Mar 18, 2010 12:23 pm    Post subject: Reply with quote

make it wait for input at the end with cin or whatever
Back to top
View user's profile Send private message
C-Dizzle
Grandmaster Cheater
Reputation: 89

Joined: 16 Mar 2008
Posts: 623

PostPosted: Thu Mar 18, 2010 12:43 pm    Post subject: This post has 1 review(s) Reply with quote

Here is the code
Code:
// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}
Back to top
View user's profile Send private message
Aqua Regia
Advanced Cheater
Reputation: 0

Joined: 12 May 2009
Posts: 51
Location: Sweden

PostPosted: Thu Mar 18, 2010 12:58 pm    Post subject: Reply with quote

I don't think this is very good.. (because it only works for windows or something like that), but I always do like this:

Code:

#include <iostream>
#include <conio.h>

using namespace std;

int main ()
{
  cout << "Hello World!";
  getch();
  return 0;
}
Back to top
View user's profile Send private message
C-Dizzle
Grandmaster Cheater
Reputation: 89

Joined: 16 Mar 2008
Posts: 623

PostPosted: Thu Mar 18, 2010 1:10 pm    Post subject: This post has 1 review(s) Reply with quote

Aqua Regia wrote:
I don't think this is very good.. (because it only works for windows or something like that), but I always do like this:

Code:

#include <iostream>
#include <conio.h>

using namespace std;

int main ()
{
  cout << "Hello World!";
  getch();
  return 0;
}

Thank you! This is much better.
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Thu Mar 18, 2010 4:07 pm    Post subject: Reply with quote

Code:
#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  system("PAUSE");
  return 0;
}
Back to top
View user's profile Send private message MSN Messenger
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Thu Mar 18, 2010 4:19 pm    Post subject: Reply with quote

iPromise wrote:
Code:
#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  system("PAUSE");
  return 0;
}


You don't actually need a return 0...
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu Mar 18, 2010 4:53 pm    Post subject: Reply with quote

_visiON_ wrote:
iPromise wrote:
Code:
#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  system("PAUSE");
  return 0;
}


You don't actually need a return 0...

actually, for once, iPromise has the right code. although admittedly that is more likely because it was a copy from someone's post above rather than a display of competence
http://users.aber.ac.uk/auj/voidmain.shtml
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Mar 18, 2010 5:10 pm    Post subject: Reply with quote

_visiON_ wrote:
iPromise wrote:
Code:
#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  system("PAUSE");
  return 0;
}


You don't actually need a return 0...


the standard dictates it so.

ps system() calls are ew, try to avoid them
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Fri Mar 19, 2010 5:28 am    Post subject: This post has 1 review(s) Reply with quote

slovach wrote:
ps system() calls are ew, try to avoid them
Code:
#include <cstdlib>

int main(int argc, char *argv[])
{
  system("ECHO Hello World!");
  system("ECHO Even random number generation works, so what's the problem?");
  system("ECHO There are %RANDOM% reasons not to use system()");
  system("ECHO Bye!");
  system("PAUSE");
  return 0;
}
What do ya mean? :P
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites