Help with my calculater program.
Code:
/////////////////////////////
////////////////////// ///
// // ///
// Calculater // ///
// Program v 1.1 // ///
// Coded by: // ///
// James AKA Kogh // ///
// // ///
///////////////////// ///
/////////////////////////////
#include <iostream.h>
int mult(int x, int y);
int add(int x, int y);
int div(int x, int y);
int sub(int x, int y);
int main()
{
char desc;
int x,y;
for (;;)
{
cout<<"Calc Program 1.1 Menu:";
cout<<endl;
cout<<"A.Add";
cout<<endl;
cout<<"B.Subtract";
cout<<endl;
cout<<"C.Multiply";
cout<<endl;
cout<<"D.Divide";
cout<<endl;
if(desc=='a'|| desc=='A')
{
cout<<"Enter two numbers to be added: ";
cin>>x>>y;
cout<<add(x,y);
}
if(desc=='b'|| desc=='B')
{
cout<<"Enter two numbers to be subtacted: ";
cin>>x>>y;
cout<<sub(x,y);
}
if(desc=='c'|| desc=='C')
{
cout<<"Enter two numbers to be multiplied: ";
cin>>x>>y;
cout<<mult(x,y);
}
if(desc=='d'|| desc=='D')
{
cout<<"Enter two numbers to be divided: ";
cin>>x>>y;
cout<<div(x,y);
}
return 0;
}
int add(int x, int y)
{
return x+y;
}
int sub(int x, int y)
{
return x-y;
}
int mult(int x, int y)
{
return x*y;
}
int div(int x, int y)
{
return x/y;
}
I'm a fairly new C++ programmer, and I was wondering why this code doesn't work... :0
If anyone could point out where i screwed it up at, it'd be greatly appretiated!
-kogh