I just started programming and I did my first basic one the "Hello World!" one and for some reason after I am done compiling I open my hello.exe file and I hit find results and it doesn't have a message at at all here is the project
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
return 0;
}
if anyone has a solution to my problem please answer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The answer to your question, and many more, can be found in the thread titled (not accidentally) "Please Read Before Posting a Question". Please check it out.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, Mark.
I'm new to programming too but let me try and help here. I don't know the compiler you are using but I used Dev-C++ 4.9.9.2 Beta to write the "Hello, World!" program and it worked for me (on Windows Vista Home Edition).
My code went like this:
include <iostream.h>
int main()
{
cout << "Hello, World!";
return 0;
}
I compiled the program, ran it and a window just splashed and disappeared. I now used the command prompt and ran it and I could now see the message "Hello, World!".
Here are the steps I took:
1. Go to command prompt (On XP, click Start --> Run then type cmd in the box)
2. type: cd \ to go to the C:\> or root directory ( note the space between cd and )
3. type: cd dev-cpp and press "Enter" to go to the Dev-C++ directory (I saved my file here) or go to the directory where you saved your file.
4. type the name of the compiled file (in my case "hello") and hit enter; you'll see the message just below this line.
Another way to see the message after compiling it and running it is to add this piece of code to your program - cin.get(); - just before your return 0; The above code will become like this:
include <iostream.h>
int main()
{
cout << "Hello, World!";
cin.get(); //this is the new line I have added
return 0;
}
I just started programming and I did my first basic one the "Hello World!" one and for some reason after I am done compiling I open my hello.exe file and I hit find results and it doesn't have a message at at all here is the project
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
return 0;
}
if anyone has a solution to my problem please answer
The answer to your question, and many more, can be found in the thread titled (not accidentally) "Please Read Before Posting a Question". Please check it out.
Wayne
Hi, Mark.
I'm new to programming too but let me try and help here. I don't know the compiler you are using but I used Dev-C++ 4.9.9.2 Beta to write the "Hello, World!" program and it worked for me (on Windows Vista Home Edition).
My code went like this:
include <iostream.h>
int main()
{
cout << "Hello, World!";
return 0;
}
I compiled the program, ran it and a window just splashed and disappeared. I now used the command prompt and ran it and I could now see the message "Hello, World!".
Here are the steps I took:
1. Go to command prompt (On XP, click Start --> Run then type cmd in the box)
2. type: cd \ to go to the C:\> or root directory ( note the space between cd and )
3. type: cd dev-cpp and press "Enter" to go to the Dev-C++ directory (I saved my file here) or go to the directory where you saved your file.
4. type the name of the compiled file (in my case "hello") and hit enter; you'll see the message just below this line.
Another way to see the message after compiling it and running it is to add this piece of code to your program - cin.get(); - just before your return 0; The above code will become like this:
include <iostream.h>
int main()
{
cout << "Hello, World!";
cin.get(); //this is the new line I have added
return 0;
}
You can find these tips here:
http://www.cprogramming.com/compiler.html
http://www.cprogramming.com/close.html
I hope it was helpful to you.
Stanis,
Please stop answering questions until you know a little better what you are
doing.
iostream.h has been deprecated since 1998, take some time and look how header
notation changed when the ANSI standard for C++ came about.
Wayne