Likes: 0
Results 1 to 5 of 5
Thread: [C++] Hello World
-
10-02-10, 12:44 PM #1
[C++] Hello World
Register to remove this adAs always, we will start with a Hello World console application. This is seen to be many peoples first coding experience and will more than likely remain that way for quite some time. Let's get started.
Lets create the frame of the application:
Code:#include <iostream> void main() { using namespace std; cout << "Hello World" << endl; cin.get(); }
So let's break this into small pieces.
Code:#include <iostream>
The angle brackets (< and >) refer to a standard header which is part of the C++ library.
iostream suggests input/output instead of random access or other things.
Next, we have:
Code:void main()
void means the function doesnt have to return anything. Normally people use int main() in which they have to return an integer. we named the function main because the first thing a program does when it runs is search for the main function to run off of.
Code:using namespace std;
Code:std::cout << "Hello World" << std::endl; std::cin.get();
Code:cout << "Hello World" << endl; cin.get();
Code:cout << "Hello World" << endl;
Code:cout<< "roflcopters";
The second part, where it has <<endl, ends the line, and the next piece of output will begin on the next line. And then you use a semicolon(;) to end the statement.
Finally we have:
Code:cin.get();
This tell the console to get the next piece of input, which should be the enter key. Once you press that, it'll close.
Thanks for reading my tutorial on the Hello World application written in C++.
If you have any questions feel free to PM me.
› See More: [C++] Hello World
-
10-02-10, 12:53 PM #2
-
14-02-10, 06:33 AM #3
-
26-04-10, 05:02 AM #4
- Rep Power
- 0
- Reputation
- 52
sdyess strikes again. not bad!
-
17-02-11, 03:40 AM #5
Register to remove this adThis tutorial for beginners in C++ programming is good
Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread
Visitors found this page by searching for:
Nobody landed on this page from a search engine, yet!
SEO Blog