Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dan Swain
committed
Apr 8, 2012
1 parent
9b54a03
commit 40a1504
Showing
1 changed file
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
# Part 1: `int main` | ||
|
||
In C and C++ programs, the | ||
The entry point for C and C++ programs is a function called `main`. The hello world program in C++ looks like this: | ||
|
||
```c++ | ||
#include <iostream> | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
std::cout << "Hello, world." << std::endl; | ||
|
||
return 0; | ||
} | ||
``` | ||
You can find the `helloworld.cpp` file in this directory. Compile and run it from the command line like this: | ||
g++ helloworld.cpp -o helloworld | ||
./helloworld | ||