Advanced programs

C++ program to copy one file to anothere file

AIM A program to copy one file to another file and convert the lower case characters to upper case characters. ALGORITHM 1) Start the process 2) Create the input file and out put file. 3) Get the input file name to fname1. 4) Get the output file name to fname2. 5) Open the infile(fanme1) 6) […]


C++ class program to illestrate File operations

AIM Write a program to illustrate the write() member function which are usually used for transfer of data blocks to the file. ALGORITHM 1. Start the process 2. Invoke the class a. Create two inline member functions .ie, getdata() and dispdata() i. getdata() for input ii. dispdata() for display 3. Open the file in fstream […]


C++ program to implement Pure Virtual Functions

AIM A program to demonstrate how a pure virtual function is defined, declared and invoked from the object of derived class through the pointer of the base class. ALGORITHM 1. Start the process 2. Invoke the class with pointer 3. Assign ptrgetdata() a. Get the roll no and name of the student 5. Call the […]


C++ program to illestrate virtual functions

AIM A program to access the member of the derived class objects through an array of members. In this program, both the base class and the derived class member functions are preceded by the keyword ALGORITHM 1. Start the process 2. Invoke the class with pointer 3. Assign ptr[0]


C++ program to illustrate the static member function

AIM Write a program to illustrate the static member function. ALGORITHM 1. Start the process 2. Invoke the class i. Set the data member and member function as a static b. Create two objects t1 and t2 3. Call the function t1.setcode i. Increment the value of data member count 4. Call the function t1.setcode […]


C++ program to illustrate Hybrid Inheritance.

C++ program to illustrate Hybrid Inheritance. #include<iostream.h> #include<conio.h> class stu { protected: int rno; public: void get_no(int a) { rno=a; } void put_no(void) { out<<"Roll no"<<rno<<"\n"; } }; class test:public stu { protected: float part1,part2; public: void get_mark(float x,float y) { part1=x; part2=y; } void put_marks() { cout<<"Marks obtained:"<<"part1="<<part1<<"\n"<<"part2="<<part2<<"\n"; } }; class sports { protected: […]


C++ program to implement three classes using multiple inheritance

MULTIPLE INHERITANCES AIM: Write a program to illustrating how all the three classes are implemented in multiple inheritance mode ALGORITHM • Start the process • Invoke the class M • Invoke the another class N • Invoke one more class,ie class P,which is inherited by both M and N • Create an object for class […]


C++ program to illustrate Multilevel Inheritance

MULTILEVEL INHERITANCE AIM: A program to illustrate multilevel inheritance. we have three classes, student, test and result. Here class student is the base class. And the class test is derived from the base class student. And the another class result is derived from the class test. ALGORITHM: • Start the process • Invoke the base […]


C++ program to illustrate a Single Inheritance

SINGLE INHERITANCE AIM: A program to illustrate a single inheritance. We have a base class B and a derived class D. The class B contains one private data member, one public data member and three public member functions. The class D contains one private data member and two public member functions ALGORITHAM: • Start the […]