CheatSheet to C++ Programming

A very simple program

// A very simple program
#include <iostream.h>
main()
{
	int one, two;
	one = 1;
	two = 2;
	cout << "One is " << one " and two is " << two << endl;
	return 0;
}
ConceptExample
Declare integerint i;
Declare real numberreal i;
Declare stringchar name[100];
Declare booleanbool b;.
Print variable 'i'cout<< i;
Print "hello world"cout << "Hello World";
Read variable 'i'cin >> i;
For loop with i in 1..10for(i=1; i < 11; i++) cout << i << endl;
If-then statementif (i == 1)
{
  cout << "I is one" << endl;
}
If-then-else statementif (i==1) return 0; else return 1;
Declare functionint double(int x)
Return from functionreturn 10;