Please correct my code, using comment // to explain what my wrong. So, i can und
ID: 3540447 • Letter: P
Question
Please correct my code, using comment // to explain what my wrong.
So, i can understand my wrong.
Thank.
My code:
#include <iostream>
using namespace std;
class NUMBERS
{
private:
int x, y;
public:
NUMBERS()
{
}
NUMBERS(const NUMBERS &rc)
{
}
void setinput(int a1,int a2)
{
x=a1;
y=a2;
}
friend int addition(NUMBERS ptr);
friend int subtract(NUMBERS ptr);
friend int max_min(NUMBERS object);
};
int addition(NUMBERS cc)
{
return (cc.x+cc.y);
}
int subtract(NUMBERS cc)
{
return (cc.x*cc.y);
}
int max_min()
{
}
int main()
{
int a, b;
int add, sub;
NUMBERS object;
cout<<"Get value of x: ";
cin>>a;
cout<<"Get Value of y: ";
cin>>b;
object.setinput(a,b);
add=addition(object);
sub=subtract(object);
cout<<"Addition of x and y : "<<add<<endl;
cout<<"Subtraction of x and y : "<<sub<<endl;
NUMBERS object2;
NUMBERS newobj1=object2;
return 0;
}
Explanation / Answer
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.