EXPERIMENT NO: 1 Aim: - Write a Program to print students name, address and contact number. #include using namespace std; struct student{ char name[100]; char address[100]; long long int phone_number; }x; int main (){ cout << "Enter your name : "; cin >> x.name; cout << "Enter your address :"; cin >> x.address; cout << "Enter your mobile number : "; cin >> x.phone_number; cout << "your name is " << x.name << "\n"; cout << "your address is " << x.address << "\n" ; cout << "your contact number is " << x.phone_number << "\n" ; return 0; } OUTPUT: Entering Information Enter Name: Yash Enter Address: Vadodara Enter Contact: 7043749514 Displaying Information Name: Yash Address: Vadodara Contact: 7043749514 OUTPUT SCREENSHOT EXPERIMENT NO: 2 Aim : WAP to find whether number is odd or even #include using namespace std; int main(){ int a; cout<<"Enter the number : "; cin>>a; if(a%2==0){ cout<<"Number is even\n"; } else{ cout<<"Number is odd\n"; } return 0; } output screenshot: Aim : WAP to make calculator using switch case # include using namespace std; int main() { char op; float num1, num2; cout << "Enter operator: +, -, *, /: "; cin >> op; cout << "Enter first number: "; cin >> num1; cout<<"Enter second number: "; cin >> num2; switch(op) { case '+': cout << num1 << " + " << num2 << " = " << num1 + num2; break; case '-': cout << num1 << " - " << num2 << " = " << num1 - num2; break; case '*': cout << num1 << " * " << num2 << " = " << num1 * num2; break; case '/': cout << num1 << " / " << num2 << " = " << num1 / num2; break; default: cout << "Invalid\n"; break; } return 0; } output screenshot: EXPERIMENT NO: 3 3.1) Aim: - Write a program to print Fibonacci series 0,1,1,2,3,5 using function.(For Looping, Condition, Function) #include void fibonacciSeries(int range) { int a=0, b=1, c; while (a<=range) { printf("%d\t", a); c = a+b; a = b; b = c; } } int main() { int range; printf("Enter range: "); scanf("%d", &range); printf("The fibonacci series is: \n"); fibonacciSeries(range); return 0; } Output Screenshot:- 3.2) Aim: - Write a program to implement arithmetic operations using inline function. #include using namespace std; inline float add(float x,float y) { return(x+y); } inline float sub(float s,float t) { return(s-t); } inline float mul(float p,float q) { return(p*q); } inline float div(float c,float d) { return(c/d); } main() { float a,b; cout<<"enter two number:"<<"\n"; cin>>a>>b; cout<<"\n"<<"ADDITION="; cout< using namespace std; void change(int data); int main() { int data=3; change(data); cout<<"Value of the data is:"< using namespace std; void swap (int *x,int*y) { int swap; swap =*x; *x=*y; *y=swap; } int main() { int x=500,y=100; swap(&x,&y); cout<<"Value of x is:"< using namespace std; int area(int s) { return (s*s); } int area(int l,int b) { return (l*b); } float area(float r) { return (3.14*r*r); } float area(float bs,float ht) { return ((bs*ht)/2); } int main() { int s,l,b; float r,bs,ht; cout<<"Enter side of a square:"; cin>>s; cout<<"Enter sides of a rectangle:"; cin>>l>>b; cout<<"Enter radius of a circle:"; cin>>r; cout<<"Enter the Base and Height of triangle:"; cin>>bs>>ht; cout<<"Area of a square is: "< using namespace std; class base { int val1, val2; public: void get() { cout<<"Enter two values:"<<"\n"; cin>>val1>>val2; } friend float mean(base ob); }; float mean(base ob) { return float(ob.val1+ob.val2)/2; } int main() { base obj; obj.get(); cout<<"Mean value is:"< using namespace std; class box {  int l,b,h;  public :  void getdim()  {  cout<<"Enter length of box:\n";  cin>>l;  cout<<"Enter width of box:\n";  cin>>b;  cout<<"Enter height of box:\n";  cin>>h;  }  void display()  {  cout<<"The length of box is : "<>n;  box bx[n];  for(int **0;i using namespace std; class date { int dd,mm,yy; public: date(int,int,int); void show(){ cout< using namespace std; class Point { private: int x, y; public: Point(int x1, int y1) { x = x1; y = y1; } Point(const Point &p1) {x = p1.x; y = p1.y; } int getX() { return x; } int getY() { return y; } }; int main() { Point p1(10, 15); Point p2 = p1; cout << " p1.x = " << p1.getX() << ", p1.y = " << p1.getY()< using namespace std; class sum { private: int num1; int num2; public: sum(int n1,int n2) { num1=n1; num2=n2; } void operator+() { int sum=0; sum=num1+num2; cout<<"Addition of the two number will be :"< using namespace std; class overloading { int value; public: void setValue(int temp) { value = temp; } overloading operator+(overloading ob) { overloading t; t.value = value + ob.value; return (t); } void display() { cout << value << endl; } }; int main() { overloading obj1, obj2, result; int a, b; cout << "Enter the value of which you want to add:"; cin >> a>>b; obj1.setValue(a); obj2.setValue(b); result = obj1 + obj2; cout << "Result of the addition is :"; result.display(); return 0; } OUTPUT:- EXPERIMENT NO: 9 9.1) AIM: Write a program to print output of a function using this pointer. INPUT:- #include using namespace std; class EXAM { int X; public : void marks(int X) { this -> X = X; } void print() { cout<<"X = "< using namespace std; class Time {     int hrs, min; public:     Time(int t)     {         cout << "Basic Type to Class Type Conversion...\n";         hrs = t / 60;         min = t % 60;     }     void show(); }; void Time::show() {     cout << hrs << ": Hours(s)" << endl;     cout << min << " Minutes" << endl; } int main() {     int duration;     cout << "\nEnter time duration in minutes : ";     cin >> duration;     Time t1 = duration;     t1.show(); } OUTPUT :- 9.3)Aim :- Write a program to one class to another class type conversion. INPUT:- #include  using namespace std; class Class_type_one {     string a = "THIS IS OOPC LAB MANUAL"; public:     string get_string()     {         return (a);     }     void display()     {         cout << a << endl;     } }; class Class_type_two {     string b; public:     void operator=(Class_type_one a)     {         b = a.get_string();     }     void display()     {         cout << b << endl;     } }; int main() {     Class_type_one a;     Class_type_two b;     b = a;     a.display();     b.display();     return 0; } OUTPUT :- EXPERIMENT-10 AIM:- Consider a class network as shown in figure given below. The class Employee derives information from both Account and Admin classes which in turn derive information from the class Person. Define all the four classes and write a program to create, update and display the information contained in Employee objects. OUTPUT: #include using namespace std; class person { string n; int c; public: void pgetdata() { cout<<"\nEnter name : "; cin>>n; cout<<"\nEnter code : "; cin>>c; } void pdisplay() { cout<<"\nName : "<>p; } void adisplay() { cout<<"\nPay : "<>e; } void addisplay() { cout<<"\nExperience : "<>a; if(a==1) { if(t==1) { m.getdata(); t++; } else { cout<<"\Cannot Create!"; } } if(a==2) { if(t==1) { cout<<"\nCreate object first!"; } else { m.getdata(); t++; } } if(a==3) { if(t==1) { cout<<"\nCreate object first!"; } else { m.display(); t++; } } }while(a>=1 && a<=3); } OUTPUT: EXPERIMENT-11 11)AIM: Declare a class called item having data members item_code, item_name, cost and discount. Derive two classes from class item, namely employee and customer. The class employee has datamembers like employee_code, employee_name and amount. The class customer has datamembers like customer_name and amount. Define following functions for - initializing data members. - displaying the values of data members. - computing amount to be paid for a purchased item. Also define function main to create objects of both derived classes and to show usage of above functions. OUTPUT: #include using namespace std; class item { int code,itemcost; double dis; string itemname; public: void item_code() { cout<<"enter the item-code=\n"; cin>>code; } void item_name() { cout<<"enter the item name\n"; cin>>itemname; } void item_cost() { cout<<"enter the item cost=\n"; cin>>itemcost; } void discount() { cout<<"discount on the item=\n"; cin>>dis; } void display_item() { cout<<"the data of the item=\n"; cout<<"item code="<>empcode; } void emp_name() { cout<<"enter the employee-name=\n"; cin>>empname; } int emp_amount() { cout<<"enter the amount of employee=\n"; cin>>empamount; } void display_employee() {>custname; } int cust_amount() { cout<<"enter the amount of the customer=\n"; cin>>custamount; } void display_customers() { cout<<"the data of the cusomers=\n"; cout<<"customer name="< using namespace std; template T add(T num1, T num2) { return (num1 + num2); } int main() { int res1 = add(6, 3); double res2 = add(3.1, 5.6); cout << res1 << endl; cout << res2; return 0; } OUTPUT:- 12.2)AIM: Write a program which adds two numbers using a class template. PROGRAM: #include using namespace std; template class test { T a, b, c; public: test(T x, T y) { a = x; b = y; } T add() { return a + b; } }; int main() { test obj(6, 12); test obj2(6.4, 8.5); int res1 = obj.add(); float res2 = obj2.add(); cout << res1 << endl; cout << res2 << endl; return 0; } OUTPUT: 18 14.9 EXPERIMENT-13 13.1)AIM:Write a program to read a text file and count the number of characters in it. Input : #include #include using namespace std; int main() {         ifstream  fin("text.txt");         char ch;         int i, c=0, sp=0;         while(fin)         {                 fin.get(ch);                                  **ch;  if((i > 63 && i < 91) || (i > 96 && i < 123))                 {                         c++;                         cout< #include #include using namespace std; int main() { fstream f1,f2,f3; string str1,str2,str3; f1.open("file1.txt",ios::in); f2.open("file2.txt",ios::in); f3.open("file3.txt",ios::out); while(getline(f1, str1)){ f3<