C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old April 30th, 2008, 10:06 PM
iDakota iDakota is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 iDakota User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 17 sec
Reputation Power: 0
Small problem probably...

Okay, so I literally JUST got into C++ programming, and I'm using Dev C++... I'm using a tutorial/guide thing to help me learn, and I create this console script that's just supposed to say "Hello world! I am a C++ program!" Well that's all fine... I compile it- no errors. But, when I run it, the thing comes up for like a millisecond and just vanishes. Does anyone know why this would be happening?

This is a copy of the script I used...

// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World!";
cout << "I'm a C++ program!";
return 0;
}

Any help would be appreciated.

Reply With Quote
  #2  
Old May 1st, 2008, 03:28 AM
Zata Zata is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 Zata User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 21 sec
Reputation Power: 0
Start - Run - cmd

then go to the dir where is your program stored and run it.
(just type the name of the compiled exe file)

Reply With Quote
  #3  
Old May 1st, 2008, 05:49 AM
iNtrUdeR iNtrUdeR is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Location: Beograd
Posts: 6 iNtrUdeR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 47 m 41 sec
Reputation Power: 0
Send a message via MSN to iNtrUdeR Send a message via Google Talk to iNtrUdeR
Or add

system("PAUSE");

Reply With Quote
  #4  
Old May 2nd, 2008, 08:50 PM
iDakota iDakota is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 iDakota User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 17 sec
Reputation Power: 0
Thanks for the help, guys. Actually what I did was at the end of the code, I just put "cin.get();" As you all probably already know, that makes you push the Enter button before the program will finish.

Reply With Quote
  #5  
Old May 2nd, 2008, 09:31 PM
eatmybinx eatmybinx is offline
Registered User
Click here for more information.
 
Join Date: Apr 2008
Posts: 50 eatmybinx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 31 m 53 sec
Reputation Power: 1
Quote:
Originally Posted by iDakota
Thanks for the help, guys. Actually what I did was at the end of the code, I just put "cin.get();" As you all probably already know, that makes you push the Enter button before the program will finish.


as does
Code:
system("PAUSE");
for windows OS anyway.

Reply With Quote
  #6  
Old May 6th, 2008, 08:52 AM
MaHuJa MaHuJa is offline
Contributing User
Click here for more information.
 
Join Date: Dec 2007
Posts: 338 MaHuJa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 14 h 13 m 10 sec
Reputation Power: 1
Send a message via Skype to MaHuJa Send a message via XFire to MaHuJa
Usually, there is an option in the IDE (most people use IDEs nowadays; MS Visual *, Eclipse, KDevelop, CodeBlocks) somewhere to make the window stay up.

The described methods are pretty much just workarounds for not turning that option on.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Small problem probably...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway