Miek Posted September 14, 2010 Posted September 14, 2010 I am taking Computer Science at University and part of it is learning C++. However, I'm having some serious problems with... everything... I'm trying to do the usual first "Hello World!" program. I am pretty sure I have the code right, but I just can't seem to find how to make some kind of viewable result. // This will print Hello World! #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; } I'm using Microsoft Visual Studio 2010 Express. How can I produce some kind of launchable, viewable result? My textbook (that cost over $150 >.>) isn't much help, outdated, and is showing that a window with "Hello World!" is somehow magically appearing after doing nothing more than entering the code in a C++ compiler. I think they skipped a few steps. Help? Share this post Link to post Share on other sites More sharing options...
dihartnell Posted September 14, 2010 Posted September 14, 2010 (edited) I am taking Computer Science at University and part of it is learning C++. However, I'm having some serious problems with... everything... I'm trying to do the usual first "Hello World!" program. I am pretty sure I have the code right, but I just can't seem to find how to make some kind of viewable result. // This will print Hello World! #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; } I'm using Microsoft Visual Studio 2010 Express. How can I produce some kind of launchable, viewable result? My textbook (that cost over $150 >.>) isn't much help, outdated, and is showing that a window with "Hello World!" is somehow magically appearing after doing nothing more than entering the code in a C++ compiler. I think they skipped a few steps. Help? Hi Meik, Welcome to C / C++ programming. You have missing the .h on your library declaration. This should have given you a compiler error to warn you of that. Edited September 14, 2010 by dihartnell Share this post Link to post Share on other sites More sharing options...
Miek Posted September 14, 2010 Posted September 14, 2010 (edited) It still doesn't seem to be working. The code I used is straight from the textbook, so I would think that it's right. I'm not saying yours is wrong... It's probably accomplishing the same task with a different method, correct? I'm also trying to figure out how in Visual Studio 2010 Express I actually compile source code into some kind of executable that I can launch and make the window with "Hello World" appear. I think I'm going to have to check back here tomorrow... I have Statistics class tomorrow and I should probably get some sleep before then. I appreciate the help a lot. Edited September 14, 2010 by Miek Share this post Link to post Share on other sites More sharing options...
Sihastru Posted September 14, 2010 Posted September 14, 2010 I have this feeling you didn't actually create the project the right way, as a console application. See this for an example, replace code with your own. Share this post Link to post Share on other sites More sharing options...
redtigerdragon Posted September 14, 2010 Posted September 14, 2010 you may need to add a pause or a cin in order for the program to wait and actually display the message for a while. Share this post Link to post Share on other sites More sharing options...
endorphiend Posted September 14, 2010 Posted September 14, 2010 I have this feeling you didn't actually create the project the right way, as a console application. See this for an example, replace code with your own. This. Once you have the correct project created and add your cpp file under source files, I believe the menu you need to go into is Debug -> Start without debugging. This should compile and run the program. Share this post Link to post Share on other sites More sharing options...
Gr4vitas Posted September 14, 2010 Posted September 14, 2010 (edited) Your program will run and complete without you seeing anything because it just pops up and goes away faster than you can see it. Adding in a system("pause"); will put a pause in the program before it ends so you can actually see the output to the console window. #include <iostream> using namespace std; int main() { cout << "Hello world"; system("pause"); } Edited September 14, 2010 by Gr4vitas Share this post Link to post Share on other sites More sharing options...
WhenKittensATK Posted September 14, 2010 Posted September 14, 2010 Off topic, but I would search your textbooks though this engine http://www.directtextbook.com/ I've saved hundreds of dollars. Share this post Link to post Share on other sites More sharing options...
hardnrg Posted September 14, 2010 Posted September 14, 2010 press F7 Share this post Link to post Share on other sites More sharing options...
Miek Posted September 16, 2010 Posted September 16, 2010 This is a random question, but what's the difference coding-wise between a 32 bit and a 64 bit program? Share this post Link to post Share on other sites More sharing options...
Sihastru Posted September 16, 2010 Posted September 16, 2010 Support for 64bit (integer) types, larger and increased number of registers, larger virtual and physical address space. Also the CPU instruction set is extended in order to take advantage of these modifications. Regarding address space, there are some hardware limitations that might limit the expected "64bit". For example AMD64 is limited to 40bit (extended to 48bit by a few tricks) virtual address space and a 36bit (extended to 52bit by a few tricks) physical address space, somewhat limited compared to the full blown 64bit address space, but in reality, other physical limitations will be reached before the actual capabilities of the architecture are. Share this post Link to post Share on other sites More sharing options...
Dariuas Posted September 20, 2010 Posted September 20, 2010 I am taking Computer Science at University and part of it is learning C++. However, I'm having some serious problems with... everything... I'm trying to do the usual first "Hello World!" program. I am pretty sure I have the code right, but I just can't seem to find how to make some kind of viewable result. // This will print Hello World! #include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; } I'm using Microsoft Visual Studio 2010 Express. How can I produce some kind of launchable, viewable result? My textbook (that cost over $150 >.>) isn't much help, outdated, and is showing that a window with "Hello World!" is somehow magically appearing after doing nothing more than entering the code in a C++ compiler. I think they skipped a few steps. Help? So, If you'd like, I can get in touch with you, and help you through this, just PM and I will contact you Like has been said by others in the post add a cin.get(); right after your cout If you use system("pause"); you'll have to #include in your preprocessor section (which is currently #include Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now