#include <iostream> #include <string.h> using namespace std; class A{ int *id; string name; string address; float *salary; public: A (int x =0, string n="unknown" ,string ad ="city=unknown country =unknown ",float s=0 ) { id = new int; *id =x; name = n; address=ad ; salary =new float; *salary =s; } ~A() { cout<<"\t\t\tThe destroctor of: " <<endl; cout<<"Id is : "<<*id <<endl; cout<<"Name : "<<name <<endl; cout<<"Address : "<<address <<endl; cout<<"Salary : "<<*salary <<endl; } void display () { cout<<"The id is : "<<*id <<endl; cout<<"The Name is : "<<name <<endl; cout<...
<< Create and Implement program in C++ to define 2 classes. Addition, subtraction, division, average, power and multiplication of 2 variables must be performed using functions. >> "With Separate Function of {Addition, subtraction, division, average, Multiplication,Power }
# include <iostream> using namespace std; class Two; class One{int a,b; public: friend class Two; void multi (){ cout<< "The Multiply of two no is :" <<a*b<<endl;} void sub(){ cout<< "The subtraction of two no is :" <<a-b<<endl;} void sum(){ cout<< "The sum of two no is :" <<a+b<<endl;} void div(){ cout<< "The division of two no is :" <<a/b<<endl;}void avg(){ cout<< "The Average of two no is :" <<(a+b)/2<<endl;}}; class Two{ int n; int power; float base_no; int res = 1; public: friend class One; void power1(){ cout << " \t<< Enter Number >>: "<<endl; cin >> base_no ; cout << " \t<< Enter power >>: "<<endl; cin >> power; cout << base_no << "^" << power << " : "; while (power != 0) { res *= base_no; --power; } cou...