solutions9 - //PRECONDITION: none //POSTCONDITION: returns...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-1100 Computer Science I Rensselaer Polytechnic Institute Spring 2004 Studio 9 -- Solutions 2. #include <iostream> using namespace std; int max3(int a, int b, int c) //PURPOSE: find the largest of three numbers //PRECONDITION: given three int numbers //POSTCONDITION: returns the largest of the three { return a; } return b; } else { return c; } } int main () //PURPOSE: test the max3 function
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //PRECONDITION: none //POSTCONDITION: returns 0 if successful { cout << "Largest of 1, 2 and 3 is " << max3(1, 2, 3) << endl; cout << "Largest of 3, 2 and 1 is " << max3(3, 2, 1) << endl; cout << "Largest of 2, 3 and 1 is " << max3(2, 3, 1) << endl; cout << "Largest of -3, -2 and -1 is " << max3(-3, -2, -1) << endl; cout << "Largest of 10, 10 and 5 is " << max3(10, 10, 5) << endl; return 0; }...
View Full Document

This homework help was uploaded on 04/16/2008 for the course CSCI 1100 taught by Professor Hardwick during the Fall '08 term at Rensselaer Polytechnic Institute.

Ask a homework question - tutors are online