Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help Forums Windows Startup Programs Database Spyware and Malware Removal Guides Computer Tutorials Uninstall Database File Database Computer Glossary Computer Resources
 

Welcome Guest ( Log In | Click here to Register a free account now! )



Register a free account to unlock additional features at BleepingComputer.com
Welcome to Bleeping Computer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.
Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

 
Reply to this topicStart new topic
> C++ Problem, It won't run
TelMeDragon
post Feb 16 2008, 01:43 AM
Post #1


Member
**

Group: Members
Posts: 68
Joined: 10-January 07
Member No.: 105,480



Ok well I decided to learn C++, and after doing a "Hello World" Basic run-through (and an attempt at a fahreneit to Celsius converter). I have failed miserably.

The converter didn't work because of some errors, I'm not sure where, i copied it straight off the book i bought.

The hello world didn't work because the program won't run. I compiled it and found the .exe and double clicked it but all that pops up is a command prompt for a second and then it disappears with ntohing else.

I am using Dev-C++

Does anyone know what's wrong?


--------------------
Go to the top of the page
 
+Quote Post
tswsl1989
post Feb 16 2008, 07:27 AM
Post #2


Forum Regular
***

Group: Members
Posts: 233
Joined: 11-June 07
From: Cymru/Wales
Member No.: 136,036



The hellow world one sounds like it's worked.
Try opening a command prompt, then running the hello world program from there.

C++ examples can often (even though they shouldn't) be compiler specific.
Try searching the net for Dev-C++ Tutorials\examples.

From another C++ learner, I hope that helps,


--------------------
Tom

Tswsl1989
Duct tape is like the force. It has a light side, a dark side, and it holds the universe together
Go to the top of the page
 
+Quote Post
groovicus
post Feb 16 2008, 08:33 AM
Post #3


Hail Groovicus!
******

Group: Site Admin
Posts: 5,985
Joined: 5-June 04
From: Vermillion, SD
Member No.: 689



C++ is not compiler specific. smile.gif

However, tswsl1989 is correct that the program probably ran fine. If the command window opened and closed, then it worked. It only takes about a tenth of a second to run a "hello world" program. As was stated, drop to a command line prompt, and execute your code from there.


--------------------
Go to the top of the page
 
+Quote Post
TelMeDragon
post Feb 16 2008, 12:54 PM
Post #4


Member
**

Group: Members
Posts: 68
Joined: 10-January 07
Member No.: 105,480



Ok thank you for your replies, and I have found my problem after digging through various codes from tutorials. Thank you once again


--------------------
Go to the top of the page
 
+Quote Post
danbrownlow
post Feb 22 2008, 08:53 AM
Post #5


Member
**

Group: Members
Posts: 84
Joined: 5-March 07
From: Brighton, UK
Member No.: 115,537



Also, when learning I realised (I'm english.. I'm not spelling wrong tongue.gif) that before returning, if you type System("pause"); then it would halt the program so you could actually see what was happening =]

Dan
Go to the top of the page
 
+Quote Post
Deemo Diablo
post Mar 23 2008, 05:38 AM
Post #6


New Member
*

Group: Members
Posts: 12
Joined: 23-March 08
From: 76704
Member No.: 198,167



If it's not too late I would like to add that entering:

char response;
std::cin >> response;



before return 0; would let you see the results of your program by closing the program only when a random character is pressed followed by the enter key upon completion of said program.

This post has been edited by Deemo Diablo: Mar 23 2008, 05:41 AM
Go to the top of the page
 
+Quote Post
Billy O'Neal
post Mar 26 2008, 09:08 PM
Post #7


Multi Megaton Malware Munition
******

Group: HJT Team
Posts: 3,838
Joined: 17-January 08
From: Northfield, Ohio
Member No.: 184,215



QUOTE(Deemo Diablo @ Mar 23 2008, 06:38 AM) *
If it's not too late I would like to add that entering:

char response;
std::cin >> response;



before return 0; would let you see the results of your program by closing the program only when a random character is pressed followed by the enter key upon completion of said program.

Careful! Dont want buffer overruns, now do we?

Billy3


--------------------
The forum is always a busy place. In the event I fail to reply within twenty-four hours, feel free to send me a PM.
Have I helped you? If so, please say so in My Guestbook.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 7th October 2008 - 11:35 PM


Advertise   |   About Us   |   Terms of Use   |   Privacy Policy   |   Contact Us   |   Site Map   |   Chat   |   Tutorials   |   Uninstall List
Discussion Forums   |   The Computer Glossary   |   Resources   |   RSS Feeds   |   Startups   |   The File Database   |   Malware Removal Guides

© 2003-2008 All Rights Reserved Bleeping Computer LLC.