Operators
Beginning C++
So far we have made simple programs that gave us a response if the condition was true and another one if the conditon was false. Now we will eloborate on the response of the program so if its a guessing game it will tell us to guess higher or lower number.

                                                                      
Relational Operators
Relational Operators will give you different responses if the variable is higher than your guess, lower than your guess or equal to your guess. Here is what they look like: <>==!=<=>=. The exclamation mark means "NOT". Here is what they all mean.

guess > 10 In this example, "guess" is the variable that is entered by the user. So if the user enters 33, 33 is equal to the variable "guess" and when anything over 10 is entered, you can specify a response of your choice.

guess < 10 This is the same sort of thing here except anything lower than 10 here will be your variable and when the variable is lower than 10, you can specify a response.

guess == 10 Again, the same idea, this time, you write a response if the variable is equal to 10.

guess != 10 If you want the program to say only one response every time the variable doesn't equal 10, this is how you write it.

guess <= 10 Here, the variable could be either less than or equal to 10.

guess >= 10 The variable could be greater than or equal to 10.


Below is the code for our program after we have included some relational operators. Take a look at this and get used to using relational operators and placing them where they belong in the code. You might notice that I have added things in the brackets after "int main" and I also included "using namespace std;", and the reason for this is because some compilers require these things in order to compile your code. Even if you compiler doesnt require these things, I suggest you put them there anyways because you will need them later on.
Input, Output and Variables
Operators
Looping
Variables
Functions
#include <iostream.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[])
{
int number = 8;
int guess;

cout << "im thinking of a number between 1 and 10\n";
cout << "enter your guess please\n";

cin >> guess;

if (guess == number) {
cout << "you are correct\n";
}
else if (guess < 8) {
cout << "guess a higher number\n";
}
else if (guess > 10) {
cout << "your not supposed to guess this high\n";
}
else {
cout << "guess a lower number\n";
}
system("pause");
return 0;
}
Download this small program below. It is the code above compiled. Take a look at how it operates and try to understand what and how the code above is telling the program to do what it does when input is entered. It might be a little confusing at first, but you will get it. Click on the link below to download the example program.  
Click here
                                                                Arithmetic Operators
Arithmetic operators can preform basic mathematical operations like addition, subtraction, multiplication, and division. There is one more that can find the remainder after division.

Addition:
+
Subtration: -
Multiplication: *
Division: /
Remainder after division: % (example: 6%4=2 because 2 is the remainder when you divide 6 by 4)

Here is a small program demonstrating how to use some arethmetic operators in a program.
#include <iostream.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[])
{
int number1, number2;

cout<<"enter to numbers to multiply together: ";

cin>>number1>>number2;

cout<<"The product is: "<<number1*number2;

system("pause");
return 0;
}
This is a program that will do multiplication only. Make sure to put a space between the two numbers for it to work correctly. In this program we declare two intergers and we obtain the input like this: "cin>>number1>>number2".
You can also make the program do other things with the two numbers by adding
cout<<the sum is: "<<number1+number2;" This will give you the sum of the two numbers and you just insert after the part of the code that tells you where the product is. You can make the program add, subtract, multiply, divide, and tell you the remainder if you insert the different operators in place of others.
                                                                     Escape Sequences
Escape sequences allow you to show some things on the screen and other output that the compiler normally does not show. Here they are below.

\n New line
\t Horizontal tab
\a Beep noise
\\
Print backslash
\? Print question mark
\" Print double quotation
\' Print single quotation

Try compiling some programs using escape sequences. The following is a program that only uses escape sequences.
#include <iostream.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[])
{
cout<<"\a\t\n\\\?\"\'";
system("pause");
return 0;
}
                                                                          Logical Operators
And: (&&) "And" will allow the block of code following two condiditons to exexute only if both conditions are true.
Or: (||)
"Or" will execute the following block of code if any one of the two condidions is true.
Not: (!) "Not"
More operators coming soon