Thanks for the answer, I understand now. I knew it had a link with the program closing itself, but now I understand exactly how it works.

N00bville is a pretty dark and gl00my place. People have to work hours and hours, thinking for a second that an elusive concept is within their grasp, and then meeting the harsh reality: nope, they still don't get it.

EDIT: Hurray, that elusive concept is now really in my grasp!

My first real program:

Code:

#include <iostream>
using namespace std;
int addition ( int a, int b );
int substraction ( int c, int d );
int multiplication ( int e, int f);
int division ( int g, int h);
int main()
{
int i;
int j = 1;
while ( j == 1 ) {
cout<<"Please choose what type of mathematical operation you want to do:\n 1.Addition\n 2.Substraction\n 3.Multiplication\n 4.Division(might be imprecise)\n Any other number.End program\n";
cin>> i;
cin.ignore();
if ( i == 1 ) {//This is the addition function.
int a;
int b;
cout<<"Enter the two numbers to be added, pressing enter after each one: ";
cin>> a >> b;
cin.ignore();
cout<<"The result is: "<< addition ( a, b )<<"\n";
}
else if ( i == 2 ) {//This is the substraction function.
int c;
int d;
cout<<"Enter the two numbers to be substracted, pressing enter after each one: ";
cin>> c >> d;
cin.ignore();
cout<<"The result is: "<< substraction (c, d )<<"\n";
}
else if ( i == 3 ) {//This is the multiplication section.
int e;
int f;
cout<<"Enter the two numbers to be multiplicated, pressing enter after each one: ";
cin>> e >> f;
cin.ignore();
cout<<"The result is: "<< multiplication ( e, f )<<"\n";
}
else if ( i == 4 ) {//This is the division section.
int g;
int h;
cout<<"Enter the two numbers to be divided, pressing enter after each one: ";
cin>> g >> h;
cin.ignore();
cout<<"The result is: "<< division ( g, h )<<"\n";
}
int k;
cout<<"Would you like to do another operation? Press 1 if you would like to, otherwise press any number: ";
cin>> k;
cin.ignore();
if ( k == 1) {
j = 1;
}
else {
j++;
}
}
cin.get();
}
int addition ( int a, int b )
{
return a + b;
}
int substraction ( int c, int d )
{
return c - d;
}
int multiplication ( int e, int f )
{
return e * f;
}
int division ( int g, int h )
{
return g / h;
}

Me = proud.