Professional Documents
Culture Documents
Output:
Enter two values: 10, 20 Mean Value is: 15
Output:
Count Objects: 2 Object Number is: 1 Count Objects: 2 Object Number is: 2
6. WAP to implement STACK using DATASTRUCTURE. 7. WAP to overload Unary Operator (-).
#include<iostream.h> #include<conio.h> class complex { int a,b,c; public: complex(){} void getvalue() { cout<<"Enter the Two Numbers:"; cin>>a>>b; }
Output:
Enter the two numbers: 3 6 Increment Complex Number 4+ 7i Decrement Complex Number 3+ 6i
Output:
Enter the value of Complex Numbers a, b 4 5 Enter the value of Complex Numbers a, b 2 2 Input Values 4 + 5i 2 + 2i Result 6 + 7i 2 + 3i
Output:
Enter two values: 5 7 Multiplication Value is: 35 Cube Value is: 25 and 343
11. WAP for Overload and Operator for adding two String.
Concatenate two strings using operator overloading in c plus plus?
12. Define class MaxMin to store a list of numbers and maximum and minimum of the data.test your class with data(-1025,168,-56,0,284,12,7).
int main() { int y,u,g,h; char c; math cir,squ; cout<<"Enter the redius:\n";// for the circle cin>>y; cir.set_value(y);
15. Design a constructor for the class BANK A/c Use Data members: 1. Name Of theAccount 2. Account Number 3.Balance A/c Member Function(Constructors) 1) To assign Initial Value 2) To deposit an amount 3) To withdraw an amount after checking balance 4) To display name and balance 16. Design a constructor for the class Employee Use Data members:
basic pay:"; Humen Resource Allowance:"; Dearness Allowance :"; Profitablity Fund:";
Output:
Enter the Number of employee:1 Enter the employee No: 150 Enter the employee Name: ram Enter the designation: Manager Enter the basic pay: 5000 Enter the HR allowance: 1000 Enter the Dearness allowance: 500 Enter the profitability Fund: 300 E.No E.name des BP HRA DA PF NP 150 ram Manager 5000 1000 500 300 6200
18. WAP to sort numbers in Ascending order using Single Inheritance. 19. WAP to convert data from class d1 to D2 using type conversion. 20. WAP to use member function.
Output:
.
#include<iostream.h> #include<conio.h> class test { int code; static int count; public : void setcode(void) { code= ++count; } void showcode(void) { cout<<"object number"<<code<<endl; } static void showcount(void) { cout<<"count"<<count<<endl; } }; int test::count; int main() { clrscr(); test t1,t2; t1.setcode(); t2.setcode(); test::showcount(); test t3; t3.setcode(); test::showcount(); t1.showcode(); t2.showcode(); t3.showcode(); getch(); return(1); }