Valhalla Legends Archive

Programming => General Programming => Topic started by: starshake111 on December 12, 2002, 11:40 AM

Title: new at c++
Post by: starshake111 on December 12, 2002, 11:40 AM
how do i change some thing when im working in a c++ source file then run the .exe it like pretty much closes right when i open it ? and how do i keep it from saying 'press any key to continue'
Title: Re: new at c++
Post by: Zakath on December 12, 2002, 01:28 PM
When I was first starting out, I used an otherwise-meaningless call to getch() to hold up program termination until I was ready for it...

Btw, this isn't really bot-related. You should have posted in the general programming forum.
Title: Re: new at c++
Post by: iago. on December 13, 2002, 08:24 AM
You can also #include <stdio.h> and at the bottom put in a system("pause") (on pc).

If you're on linux, it's all good since it runs in terminal anyway and you wouldn't have that problem.

If you're on mac, get a real computer.
Title: Re: new at c++
Post by: Nova1313 on December 24, 2002, 01:51 PM
you missed something...

what if your mac runs linux :p

Oh yeah and OS X is based on Bsd so it's unix ish you can get a terminal and run stuff so again you shouldn't have trouble... unless you have os9 then i have to agree get a real computer.
Title: Re: new at c++
Post by: iago on December 25, 2002, 09:30 PM
If there's a picture of an apple anywhere on the computer the it's garbage.. sorry :P
Title: Re: new at c++
Post by: Etheran on December 26, 2002, 01:20 AM
mmmm apple.
Title: Re: new at c++
Post by: Necrosis on December 31, 2002, 02:15 PM
int endme;
cout << "\nPress any key";
cin >> endme;
Title: Re: new at c++
Post by: Feruk on December 31, 2002, 02:18 PM
Haha OMG in all my time programming, I never thought of doing something as easy as easy as what Necrosis suggested. By the way, it would work a little different since the user would also have to press enter.
Title: Re: new at c++
Post by: Zakath on December 31, 2002, 02:38 PM
I still prefer getch().

printf( "Press any key to terminate" );
getch();
return 0;
Title: Re: new at c++
Post by: Eibro on December 31, 2002, 09:47 PM
Too bad getch is non-standard.
You could get the best of both worlds (not having to press enter + standard function) with cin.get();
Title: Re: new at c++
Post by: Skywing on December 31, 2002, 10:07 PM
getc(stdin); // this will work and it's standard!
Title: Re: new at c++
Post by: Mesiah / haiseM on January 01, 2003, 04:56 PM
QuoteBtw, this isn't really bot-related. You should have posted in the general programming forum.

This is the general programming forum lol
Title: Re: new at c++
Post by: Skywing on January 01, 2003, 05:20 PM
QuoteThis is the general programming forum lol
Probably because someone moved the topic...
Title: Re: new at c++
Post by: Zakath on January 03, 2003, 05:10 PM
QuoteProbably because someone moved the topic...

Indeed.