Write the program of function templates, C/C++ Programming

Assignment Help:

Consider the following example:

int max(int x, int y)

                 {

                                return ( x > y) ? x : y ;

                 }

 

float max(float x, float y)

                 {

                                return ( x > y) ? x : y ;

                 }

 

 long max( long x,  long y)

                 {

                return ( x > y) ? x : y ;

                 }

 

char max(char x, char y)

                 {

                                return ( x > y) ? x : y ;

                 }

                void main()

                {

                  cout << max( 1,2) << endl;

                  cout << max( 4L,3L) << endl;

                  cout << max( 5.62,3.48) << endl;

                  cout << max('A','a') << endl;

                }


The output is :

                                                2

                                                4

                                                5.62

                                                a

 


Related Discussions:- Write the program of function templates

Assignment, Hi, Can i get a quote for my Programming assignment

Hi, Can i get a quote for my Programming assignment

Spaning tree , what is the function of spanning tree in graph algorithm?

what is the function of spanning tree in graph algorithm?

Decodethecode, 6999066263304447777077766622337778 -----> message sent by th...

6999066263304447777077766622337778 -----> message sent by the first smuggler. my name is robert---------> message decoded by the second smuggler. Where ‘0’ denotes the "space".

Title, #questionAt a shop of marbles, packs of marbles are prepared. Packet...

#questionAt a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets

Change to palindrome, A palindrome is a string that reads the same from bot...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Reverse a string - c ++ program, Reverse a string - C ++ program: Writ...

Reverse a string - C ++ program: Write a program in c to reverse a string. int main() {     Stack theStack;     String reverse("reverse");       cout

Application for tag in the forest game, Your program should use the Free Pa...

Your program should use the Free Pascal compiler or the Lazarus IDE described in CSC 540. When you hand in your assignment to the digital dropbox, it should be a .PAS file, not zip

Introduction to C language, Design and implement a library system that does...

Design and implement a library system that does the following: ? Takes details of a student/library users: first name, last name, other names, user ID number, and nationality. Th

Program is to define a class as employee, Program is to define a class as e...

Program is to define a class as employee: Write a program to define a class as employee and collect information about them by using classes and object class employee   {

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd