Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2014
Prepared By
Approved By
Mamatha Balachandra
(H.O.D)
Week-wise Schedule
Week 1
Week 2
Week 3
Week 4
Week 5
Week 6
Week 7
Files
Week 8
Week 9
Week 10
Week 11
Week 12
Week 13
Test (batch I)
Week 14
5M
Test
20M
The test will be conducted after completion of twelve experiments / entire lab
syllabus.
3a. Define a class named Movie. Include private fields for the title, year, and name of the
director. Include three public functions with the prototypes
void Movie::setTitle(char [ ]);
void Movie::setYear(int);
void Movie::setDirector(char [ ]);
Include another function that displays all the information about a Movie.
3b. Include a function which accepts 2 objects of type Movie and displays whether or not they
were released in the same year and also whether the Directors are same. String functions may be
used.
4. Create a class called Counter that contains a static data member to count the number of
Counter objects being created. Also define a static member function called showCount() which
displays the number of objects created at any given point of time. Illustrate this.
2. Create a base class called Shape. Use this class to store 2 double type values which could be
used to compute the area of figures. Derive 2 specific classes called Triangle and Rectangle from
the base class Shape. Add to the base class, a member function called GetData to initialize base
class data members and another member function displayArea to compute and display the area of
figures. Make displayArea a virtual function and redefine this function in the derived classes to
suit their requirements. Using these three classes design a program which will accept dimensions
of a triangle or rectangle interactively and display the area.
Week 7 (Files)
1. Write a C++ program to create 2 text files: file1.txt and file2.txt. Store the contents in both the
files. Crate a third file main.txt. Copy the contents of file1.txt and file2.txt to the main.txt file and
display the resultant file.
2. Write a C++ program to create a file Integer.dat and store integers in it. Read the file
Integer.dat and copy the odd numbers into odd.dat file and even numbers to even.dat files.
Display the contents of both the files odd.dat and even.dat.
3.Write a C++ program to create a text file infile.txt and store some sentences in it. Create
second file called outfile.txt. Read the infile.txt file, convert and write lowercase letters to
uppercase letters to the file outfile.txt. Display outfile.txt.
4. Write a C++ program which demonstrates the writing of objects to a file.
2. Write a function to overload + operator to add any two complex numbers and demonstrate this
by writing a suitable main function.
4. Create a class to represent a string, called String consisting of 2 private data members one
pointer to character and second for the length. Include appropriate constructors and destructors to
set the values of String object by allocating memory dynamically. Overload the operators ++
and -- to add and delete a character from the String object respectively.
(iv) Add_At_Last member function which inserts a NODE at the end of the list.
(v) Delete_At_Head member function which deletes a NODE from the first of the list.
(vi) Delete_At_Tail member function which deletes a NODE from the last of the list.
(vii) Is_Empty which determines whether the list is empty or not.
(viii) display to display the list.
2. Solve the above same problem by making the list a doubly linked list.
Week 13
Test batch I
Week 14
Test batch II
Text Books:
1. Sourav Sahay, Object oriented programming with C++, Oxford Higher Education, 2008.
References:
1. Stanley B Lippman, Josee Lajoe, Barbara E Moo, C++ Primer, , 4th edition 2005.
2. Robert Lafore, Object oriented programming in C++, Galgotia publications, 3rd edition,
2006.