This is the code i wrote for a simple calculator. The problem is that the choices aren't going through...if you compile it, you'll see.

if you compile it, make sure to keep on trying numbers, because it goes through the different functions 1 at a time, the selection part is what isn't working, look:

// calculator.cpp : Defines the entry point for the console application.

//

#include <iostream.h>

#include <windows.h>

int subtraction ()

{

int r,a,b;

cout<<"Enter First Number"<<endl;

cin>>a;

cout<<"Enter Second Number"<<endl;

cin>>b;

r=a-b;

cout<<"Subtraction Results:"<<r<<endl;

int main();

}

int addition ()

{

int ad,c,d;

cout<<"Enter First Number"<<endl;

cin>>c;

cout<<"Enter Second Number"<<endl;

cin>>d;

ad=c+d;

cout<<"Addition Results:"<<ad<<endl;

int main();

}

int multi ()

{

int mul,e,f;

cout<<"Enter First Number"<<endl;

cin>>e;

cout<<"Enter Second Number"<<endl;

cin>>f;

mul=e*f;

cout<<"Multiplication Results:"<<mul<<endl;

int main();

}

int div ()

{

int quot,g,h;

cout<<"Enter First Number (number to divide)"<<endl;

cin>>g;

cout<<"Enter Second Number (divided by)"<<endl;

cin>>h;

quot=g/h;

cout<<"The Quotient Is:"<<quot<<endl;

int main();

}

int squarert ()

{

int squa,i;

cout<<"Enter the number to be Square rooted"<<endl;

cin>>i;

squa=sqrt(i);

cout<<"The Square Root of"<<i<<"is:"<<squa<<endl;

int main();

}

int main(int argc, char* argv[])

{

cout<<"Welcome to Smoose777's Calculator, version 1.0"<<endl;

int com;

cout<<"Type 1 now for a list of commands"<<endl;

cin>>com;

if (com = 1) {

cout<<"List of commands:"<<endl;

cout<<"Type 1 to access the addition part of the calculator"<<endl;

cout<<"Type 2 to access subtraction part of the calculator"<<endl;

cout<<"Type 3 for multiplication part of the calculator"<<endl;

cout<<"Type 4 to access the division part of the calculator"<<endl;

cout<<"Type 5 to access the square root part of the calculator"<<endl;

int functio;

cout<<"Please enter the function you would like to use now."<<endl;

cin>>functio;

if (functio = 1)

{

addition ();

}

if (functio = 2)

{

subtraction ();

}

if (functio = 3)

{

multi ();

}

if (functio = 4)

{

div ();

}

if (functio = 5)

{

squarert ();

}

else {

cout<<"That is not a valid function"<<endl;

}

}

return 0;

}