


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Rothstein; Class: INTRODUCTION TO COMPUTER PROGRAMMING; Subject: Computer Science; University: Kent State University; Term: Spring 2010;
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!



YOUR NAME: ______________________________________________________________
1. (10 points) Write a multiway if-else statement that outputs “Its hot!” if the value of the variable temperature is greater than 80, it outputs “Its nice!” if the value of the variable temperature is between 65 and 80, and otherwise outputs “Its cold!” if ( temperature > 80 ) cout << “Its hot!\n”; else if (temperature > 65 ) cout << “Its nice!\n”; else cout << “Its cold!\n”;
3. (15 points) Write a function declaration (prototype) and a function definition for a function that takes three arguments, of type double and returns their average. double average(double a,double b,double c); double average(double a,double b,double c){ return ((a+b+c)/3.0); }