- Joined
- Sep 20, 2002
- Location
- New York
In an attempt to:
a: get my program to work
b: get one of my threads stickied
I have decided that this forum needs a thread where all the expert programmers here, can help debug setions of code and stuff.
To start this (amazing ) thread off, I'll post my program I need help fixing. (if this thread is dumb, and not needed, can some one at least help me debug this program?)
#include <iostream.h>
int add(int x, int y);
int mult(int x, int y);
int main()
{
int x, y;
int a;
int m;
cout<<"Press one(1) to multiply, and two(2) to add." cin<<m;
if(m=1)
{
cout<<"Please input two numbers to be multiplied: ";
cin>>x>>y;
cout<<"The product of your two numbers is "<<mult(x, y);
cin>>a;
return 0;
}
else
{
cout<<"Please input two numbers to be added: ";
cin>>x>>y;
cout<<"The sum of the two numbers is "<<add(x,y);
cin>>a;
return 0;
}
int mult(int x, int y)
{
return x*y;
}
int add(int x, int y)
{
return x+y;
}
a: get my program to work
b: get one of my threads stickied
I have decided that this forum needs a thread where all the expert programmers here, can help debug setions of code and stuff.
To start this (amazing ) thread off, I'll post my program I need help fixing. (if this thread is dumb, and not needed, can some one at least help me debug this program?)
#include <iostream.h>
int add(int x, int y);
int mult(int x, int y);
int main()
{
int x, y;
int a;
int m;
cout<<"Press one(1) to multiply, and two(2) to add." cin<<m;
if(m=1)
{
cout<<"Please input two numbers to be multiplied: ";
cin>>x>>y;
cout<<"The product of your two numbers is "<<mult(x, y);
cin>>a;
return 0;
}
else
{
cout<<"Please input two numbers to be added: ";
cin>>x>>y;
cout<<"The sum of the two numbers is "<<add(x,y);
cin>>a;
return 0;
}
int mult(int x, int y)
{
return x*y;
}
int add(int x, int y)
{
return x+y;
}