PracticeTest2 CS101

PracticeTest2 CS101 - Practice Quiz CS101 1) Write a C+...

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

View Full Document Right Arrow Icon
Practice Quiz CS101 1) Write a C++ function “ Process_List ” to read a list of real numbers a file. If any of the numbers are negative skip them but count them and return the count to the calling program, return the average of the positive numbers. File handler is passed as an argument to the function. (You need to decide pass by value or reference is required) 2) Write a C++ function “ Process_Num ” to receive a float number as argument, find and report the ceil, floor, and rounded number in the form of long type to the calling program. Ceil means the next higher whole number, floor mean the previous whole number and round means if the first digit is 5 or greater then use ceil, if it is smaller than 5 then use the floor. You may use any system math function or make your own calculation, just make sure it works for all possible conditions. Example: for 3.4234 ceil is 4, floor is 3 and round is 3 ; for 2345.89997 ceil is 2346, floor is 2345, and rounded is 2346. 3) Assuming the following class is available:
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online