OOPC Practicals for 4th Semester
Object Oriented Programming with C++ practicals for 4th Semester (Jan 2015) of BITS Edu Campus, under the syllabus provided by Gujarat Technological University (GTU).
Practical List OBJECT ORIENTED PROGRAMMING WITH C++ SUBJECT CODE: 2140705 B.E. 4th SEMESTER
- Write a C++ program to display “Hello World”.
- Write a program to read two numbers through keyboard and display their average on the screen.
- Write a program to read 2 numbers through keyboard and perform various arithmetic operations(addition,subtraction etc) .
- Write a program to find the largest value among 3 numbers.
- Write a program to find the sum and average of first 10 even numbers.
- Write a program to read a number n and digit d .Check whether d is present in the number n.If it is so,find out the position of d in the number n.eg: n=75689,d=5 i.e. 5 is present at the position 2
- Write C++ program to read a positive integer n and generate numbers in the following form: Eg:n=5 then o/p :5 4 3 2 1 0 1 2 3 4 5
- Write a program to generate Fibonacci series of n numbers.
- Write a program to find the sum of following series using functions: Sum=x-(x^3)/3! + (x^5)/5!-….(x^n)/n!
- Write a program to exchange the content of 2 variables using: Call by value and call by reference.
- Write a program to find the square of a number belonging to 3 datatypes namely int,float and double using function overloading.
- Write a program to find the area and perimeter of circle,square and rectangle by using 1)Function overloading 2) Inline function. Write a program using inline function to find the largest of 3 numbers.
- Write a program to show book information(name,author,price) by using classes and methods.
- Write a program to perform different arithmetic operations using class and member functions.
- Write a program to find a largest number by using nesting of member function.
- Write a program to count the number of objects of class by using1)Static member variable 2)Static member function.
- Create a class account.It has 3 data members accound id,name and balance.Define function to assign value and display value.Define function that search account no given by the user.If account no exists,print detail of that account.Write a program using array of object.Declare atleast 3 account and print details.
- Write a program to find minimum from 2 nos using friend function.
- Define a class matrix with an integer array of 3x3 as a data member.Define a friend function which adds 2 matrix objects and returns resultant matrix object.
- Write a program to add complex number using constructor overloading.
- Write a program to demonstrate destructor.
- Write a program to define how the unary minus operator is overloaded.
- Write a program to add 2 complex nos using operator overloading.
- Write a menu driven program that performs following functions on strings using operator overloading:Concatenate two strings(+ operator),Check whether first string is smaller than the second(<= operator)
- Write a program to read the data members such as rollno,name,gender,height,weight and provide member functions getdata() and display().It consists of 2 classes basicinfo and physical fitness class.Use inheritance.
- Create 3 classes basicinfo,academic info,physical fitness.Read name,rollno,gender,height,weight,course,semester,rank through keyboard.Provide getdata and display member functions.Use inheritance.
- Create a class student that sytores rollno,name.Create a class test that stores marks obtained in 5 subjects.Class result is derived from student and test contains the total marks and percentage obtained in test.Input and display information of a student.
- Class employee(name,code,pay,experience) derives information from both account(pay) and admin (experience)classes which in turn derive information from the class person.define all the four classes and write a program to create and display the information contained in employeeobjects.
- Assume that the test result of a batch of students is stored in 3 different classes.Class student stores the rollno,Class test stores the marks obtained in 2 subjects and class result contains the total marks obtained in the test.Use multilevel inheritance.
- Write a program to demonstrate this pointer.
- Write a program to demonstrate virtual functions through inheritance.
- Write a program to read a text file and display the contents on the screen.
- Write a program to copy the contents of a text file into another.
- Write a program to convert a lowercase character of a text file to uppercase characters and store it in another file.
- Write a program to define a function template for summing an array of integers and an array of floating point numbers.
- Write a program to define a function template for swapping 2 nos. of integers and floating point .
- Write a program to perform Bubble sort using template function.
- Write a program to show how to define and declare a class template for reading 2 items(int,float) from the keyboard and to find the sum of the given 2 items.
Format of file: All programs are hand-written. It should contain program definition, relevant theory (if applicable), code, and output.