One of the best ways to learn how to program in a new language is by looking at lots and lots of example programs. The best thing to do is to copy and paste each program below into a text file and compile it. Then, try the experiments. By extending these example programs, you will gain familiarity with different aspects fo C++, and you will feel more confident when it comes time to write programs from scratch.
// hello.cpp: Maggie Johnson
// Description: a program that prints the immortal saying "hello world"
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}
Some experiments to try:- The most important thing is to make sure you can compile and run this program.
Comments
Post a Comment