| View previous topic :: View next topic |
| Author |
Message |
Hackerdevelopment Advanced Cheater
Reputation: 0
Joined: 11 Oct 2007 Posts: 55
|
Posted: Sat Oct 20, 2007 1:18 pm Post subject: Problem! |
|
|
I am using dev c++.
I place this:
#include <iostream>
using namespace std;
int main() {
cout<<"Never fear, C++ is here!";
return 0;
}
I compile it and run but wen it runs it closes before i get to see it.
Wat can i do?
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Sat Oct 20, 2007 1:23 pm Post subject: |
|
|
| use cin.get();
|
|
| Back to top |
|
 |
Hackerdevelopment Advanced Cheater
Reputation: 0
Joined: 11 Oct 2007 Posts: 55
|
Posted: Sat Oct 20, 2007 1:31 pm Post subject: |
|
|
Is there any other compiler i can use? That wont make it close?
Some one give me a download link.
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Sat Oct 20, 2007 1:33 pm Post subject: |
|
|
| Hackerdevelopment wrote: | Is there any other compiler i can use? That wont make it close?
Some one give me a download link. |
read what I posted, use this:
| Code: | #include <iostream>
using namespace std;
int main() {
cout<<"Never fear, C++ is here!";
cin.get();
} |
Or run it in cmd mode:
Start => run => cmd => enter this:
| Code: | cd C:\where\is\your\exe
loololol.exe |
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Sat Oct 20, 2007 1:34 pm Post subject: |
|
|
| Hackerdevelopment wrote: | Is there any other compiler i can use? That wont make it close?
Some one give me a download link. |
It isn't the compiler that makes it close, it is the program itself. Go to the link I gave you.
|
|
| Back to top |
|
 |
assaf84 Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 238
|
Posted: Sat Oct 20, 2007 1:44 pm Post subject: |
|
|
| I think that someone should make a topic about such things and stick it, this is about the 234645724 time that someone asks this question..
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Oct 20, 2007 1:57 pm Post subject: |
|
|
God, I'm so sick of people posting the same thing. Just replace cin.get(); with return 0. But then some people will say to have return 0; since you did say to return an int to main, so you cna just put cin.get(); before return 0;. So it can be this:
| Code: |
#include <iostream>
using namespace std;
int main()
{
cout<<"Never fear, C++ is here!";
cin.get();
}
|
or
| Code: |
#include <iostream>
using namespace std;
int main()
{
cout<<"Never fear, C++ is here!";
cin.get();
return 0;
}
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Hackerdevelopment Advanced Cheater
Reputation: 0
Joined: 11 Oct 2007 Posts: 55
|
Posted: Sat Oct 20, 2007 2:03 pm Post subject: |
|
|
| Wait. Y does it close so fast?
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Sat Oct 20, 2007 2:07 pm Post subject: |
|
|
because it did everything you said it have to do then the next one is it has to close.
But cin.get() waits for an entry.
|
|
| Back to top |
|
 |
Hackerdevelopment Advanced Cheater
Reputation: 0
Joined: 11 Oct 2007 Posts: 55
|
Posted: Sat Oct 20, 2007 2:18 pm Post subject: |
|
|
| Alright thanks!
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sat Oct 20, 2007 6:54 pm Post subject: |
|
|
| use #include <stdio.h> and #inclue <conio.h> and then instead of return 0 use getch(); and instead int main() use void main().
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sat Oct 20, 2007 6:56 pm Post subject: |
|
|
| printf();
|
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Sat Oct 20, 2007 6:59 pm Post subject: |
|
|
| Symbol wrote: | | use #include <stdio.h> and #inclue <conio.h> and then instead of return 0 use getch(); and instead int main() use void main(). |
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Oct 20, 2007 7:03 pm Post subject: |
|
|
Pretty sure symbol and kasper = delphi peplz, so don't listen to their C++ nonsense.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
|