This document contains an assignment for an Object Oriented Programming course. It lists 7 programming tasks involving C++ templates including writing programs to swap data and perform arithmetic using function templates, overloading template functions, demonstrating constructor overloading in generic functions, implementing bubble sort on different data types using templates, and creating a class template to store key-value pairs with generic types. Students are asked to provide their name and registration number.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
26 views
Assignment 8
This document contains an assignment for an Object Oriented Programming course. It lists 7 programming tasks involving C++ templates including writing programs to swap data and perform arithmetic using function templates, overloading template functions, demonstrating constructor overloading in generic functions, implementing bubble sort on different data types using templates, and creating a class template to store key-value pairs with generic types. Students are asked to provide their name and registration number.
1. Write a C++ program to swap data using function templates.
2. Write a C++ program to add two numbers using function template. 3. C++ program to overload template function for sum of numbers. 4. Write a C++ program to demonstrate contractor overloading in the generic function, means that the overloaded template functions can differ in the parameter list. 5. Implementing Bubble Sort of int and float numbers using templates in C++. 6. Write a C++ Program to add, subtract, multiply and divide two numbers using class template. 7. Write a C++ Program to create a class template called "Map" that can store key-value pairs where the key is of type "T" and the value is of type "U". The template types can be replaced with any data type when an object of the class is created.