#include<iostream.h>
#include<conio.h>
class twonum
{
private :
int x,y;
public:
void getvalues()
{
cout<<"enter any two numbers";
cin>>x>>y;
}
void putvalues()
{
cout<<"\n\n"<<x<<","<<y;
}
int add(int x,int y)
{
return(x+y);
}
int multiply(int x,int y)
{
return(x*y);
}
void swap(int x,int y)
{
int c;
c=x;
x=y;
y=c;
cout<<x<<","<<y;
};
void main()
{
clrscr();
int k,j,l;
twonum s;
s.getvalues();
s.putvalues();
k=s.add(x,y);
cout<<"addition:"<<k;
j=s.multiply(x,y);
cout<<"multiplication:"<<j;
s.swap(x,y);
getch();
}
TĦɇ Ãðît
0
Newbie Poster
Recommended Answers
Jump to PostRegarding conio.h, getch, clrscr, not everyone has conio.h. You might try changing iostream.h to iostream. "void main" should probably be "int main" and your main function should return 0.
Those "problems" might allow it to compile on your machine and not on others, but the actual errors are below.
…
All 4 Replies
rproffitt
2,563
"Nothing to see here."
Moderator
AssertNull
1,094
Practically a Posting Shark
AssertNull
1,094
Practically a Posting Shark
rproffitt
commented:
You made good points as well. The code, well, it's just a code dump and run with many dangling unspoken questions.
+11
tinstaafl
1,161
Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.