Getting Started
If you missed lab or failed to copy my code from the projector during lab session, the files I typed/utilised during lab sections 1 and 2 are available here: [LINK]
Synopsis
Welcome to CS102! In this class, you will be learning the basics of the C++ Programming Language and how to use it to write basic programs. It is important that you develop the ability to problem solve with programming.
Your First Program
Let's get straight into it with the boring "Hello, World!" example that all programming languages use:
#include <iostream>

using namespace std;

int main() {
	cout << "Hello, World!" << endl;
}
Run this code in CodeLite (or whatever IDE or compiler you use) and it should print out the following text:
Hello, World!
From the code above, you should now understand that "cout" allows a user to print out text to the console.
Understanding cout
cout is an interesting beast, allowing you to print out things to the console. It doesn't have to just be a fixed string of text, it can also be a number.
#include <iostream>

using namespace std;

int main() {
	int a = 2;
	cout << "A is " << a << endl;
}
This will print out:
A is 2
Seeing a pattern here? We can print out multiple things with cout just by adding more "<<"!
Reading input with cin
You've had your fun with cout'ing a few things... but now it is time to actually read in text. We have "cin" which accepts input from the console and puts it into our program:
#include <iostream>

using namespace std;

int main() {
	int a;
	cout << "Enter A: ";
	cin >> a;

	cout << "A is " << a << endl;
}
This program will pause after printing out "Enter A:" and wait for the user to input a value. If the user input "5" and pressed enter, the program's output would look like this:
Enter A: 5
A is 5
Example: Simple addition with two numbers
Let's say you wanted to read in two numbers, let the computer do addition on them, and then print out the result?
#include <iostream>

using namespace std;

int main() {
	int a, b, c;
	cout << "Enter A: ";
	cin >> a;
	cout << "Enter b: ";
	cin >> b;
	c = a + b;

	cout << "Result is " << c << endl;
}
If you wanted to skip a step and not use "c", you can do this:
#include <iostream>

using namespace std;

int main() {
	int a, b;
	cout << "Enter A: ";
	cin >> a;
	cout << "Enter b: ";
	cin >> b;

	cout << "Result is " << (a + b) << endl;
}