Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 18th, 2005, 3:53 PM   #1
Thekingryaan
Programmer
 
Thekingryaan's Avatar
 
Join Date: Jul 2005
Location: Texas, Conroe
Posts: 33
Rep Power: 0 Thekingryaan is on a distinguished road
Send a message via AIM to Thekingryaan
Help.

Hey i bought the SAMS LEARN C++ IN 24 HOURS, and it came with a compiler, well I put this code in;

#include <iostream>

int main()
{
std::cout << "WHATS UP DOG!\n";
return 0;
}


Why Wont it work? Should i use another compiler?
Thekingryaan is offline   Reply With Quote
Old Jul 18th, 2005, 4:13 PM   #2
Shapeless
Programmer
 
Shapeless's Avatar
 
Join Date: Jul 2005
Location: germany/hamburg
Posts: 32
Rep Power: 0 Shapeless is on a distinguished road
Send a message via ICQ to Shapeless Send a message via MSN to Shapeless
//edit ---forget it---
//edit2 hmm the code seems to be right, so what does the compiler tell you why i doenst work..
any error messages ?
or does compiling work and u cant execute it? well in this case it does work u cant just see the window which contains the output, so you have to add
for example
std::cin.get();
in the line above "return 0;"
then the window "waits" for the next "enter"
__________________
of all the things he has lost, i think he misses his mind the most

typedef typename pizza_t<oven_policy<225,12.5>,ingredient_policy<salami,mushroom,cheese> > Pizza;
Shapeless is offline   Reply With Quote
Old Jul 18th, 2005, 4:28 PM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Chances are it works fine... it just goes away before you can see it...

Shapeless has some good suggestions... an alternative is:

#include <cstdlib>
...
system("PAUSE");
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Jul 18th, 2005, 5:33 PM   #4
Thekingryaan
Programmer
 
Thekingryaan's Avatar
 
Join Date: Jul 2005
Location: Texas, Conroe
Posts: 33
Rep Power: 0 Thekingryaan is on a distinguished road
Send a message via AIM to Thekingryaan
Ok i did it. But im using C++ Builder X, or xx. And it comes up on the bottom iwth the where the file is and then under it, it says Hello World!, But im confused becuz it doesnt come up in a actual console.
Thekingryaan is offline   Reply With Quote
Old Jul 18th, 2005, 5:36 PM   #5
Thekingryaan
Programmer
 
Thekingryaan's Avatar
 
Join Date: Jul 2005
Location: Texas, Conroe
Posts: 33
Rep Power: 0 Thekingryaan is on a distinguished road
Send a message via AIM to Thekingryaan
Ok instead of using the C++ builder X, i used Dev-C++ the one eleryone talks about, And it worked!, But how do i save it as the exe, so when i click the file it just runs the actual thing
Thekingryaan is offline   Reply With Quote
Old Jul 18th, 2005, 5:46 PM   #6
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,667
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
when you compile it in dev-c++ it will create the .exe for you using the same name as the project i believe in the same folder you saved the files
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is online now   Reply With Quote
Old Jul 18th, 2005, 5:49 PM   #7
Thekingryaan
Programmer
 
Thekingryaan's Avatar
 
Join Date: Jul 2005
Location: Texas, Conroe
Posts: 33
Rep Power: 0 Thekingryaan is on a distinguished road
Send a message via AIM to Thekingryaan
Ok i saved it after compiling, it juste has the soruce file and all that saved.. no exe.
Thekingryaan is offline   Reply With Quote
Old Jul 18th, 2005, 5:58 PM   #8
Shapeless
Programmer
 
Shapeless's Avatar
 
Join Date: Jul 2005
Location: germany/hamburg
Posts: 32
Rep Power: 0 Shapeless is on a distinguished road
Send a message via ICQ to Shapeless Send a message via MSN to Shapeless
Quote:
Ok i saved it after compiling, it juste has the soruce file and all that saved.. no exe.
no you cant save it as an .exe u can just save the source- object- and project files.
if compiling and linking is successfull , the ide will build the .exe which of course is in the same directory ( using dev-cpp)
__________________
of all the things he has lost, i think he misses his mind the most

typedef typename pizza_t<oven_policy<225,12.5>,ingredient_policy<salami,mushroom,cheese> > Pizza;
Shapeless is offline   Reply With Quote
Old Jul 18th, 2005, 6:14 PM   #9
Thekingryaan
Programmer
 
Thekingryaan's Avatar
 
Join Date: Jul 2005
Location: Texas, Conroe
Posts: 33
Rep Power: 0 Thekingryaan is on a distinguished road
Send a message via AIM to Thekingryaan
Ya i saved it and then three files came up. HelloWold.cbx , hello.cbx.local , Helloworld.cpp... What do i do to run it out of the compiler. with those files.

EDIT IF SOMEONE HAS AIM , Plz aim me at ANGELpaintball44
Thekingryaan is offline   Reply With Quote
Old Jul 20th, 2005, 10:52 AM   #10
Brent
Highly Adaptive Penguin
 
Brent's Avatar
 
Join Date: May 2005
Location: United States
Posts: 252
Rep Power: 4 Brent is on a distinguished road
#include <iostream>

using namespace std //add this here

int main()
{
std::cout << "WHATS UP DOG!\n";
return 0;
}
Brent is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:29 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC