Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
#include<iostream.h>
#include<conio.h>
class Sum
{
private:
int a,b,t;
public:
void getdata(void);
void putdata(void);
};
void Sum||getdata(void)
{cout<<"enter the values of A&B";
cin>>a>>b;
void Sum||putdata(void)
{t=a+b;
cout<<"sum="<<t;
}
int main()
{
sum obj;
obj.getdata();
obj.putdata();
getch();
return 0;
}

What I have tried:

i tried but the error is occured during execution
plz sove this problem.
Posted
Updated 3-Dec-16 0:13am
Comments
Arthur V. Ratz 3-Dec-16 6:13am    
See my solution and it's obvious.

1 solution

C++
#include<iostream.h>
 #include<conio.h>
 class Sum
 {
 private:
 int a,b,t;
 public:
 void getdata(void);
 void putdata(void);
 };
 void Sum::getdata(void)
 {cout<<"enter the values of A&B";
 cin>>a>>b;
 void Sum::putdata(void)
 {t=a+b;
 cout<<"sum="<<t;&lt;!-- newline="" --=""> }
 int main()
 {
 sum obj;
 obj.getdata();
 obj.putdata();
 getch();
 return 0;
 }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900