Explore BrainMass

Determining the Largest of 15 Numbers Given

I need help with these problems

Create a program to determine the largest number out of 15 numbers entered (numbers entered one at a time). This should be done in a function using this prototype:

double larger (double x, double y);

Make sure you use a for loop expression inside your function.

Enter 15 numbers
11 67 99 2 2 6 8 9 25 67 7 55 27 1 1
The largest number is 99


* Read the first number of the data set. Because this is the only number read to this point, you may assume that it is the largest number so far and call it max.
* Read the second number and call it num. Now compare max and num, and store the larger number into max. Now max contains the larger of the first two numbers.
* Read the third number. Compare it with max and store the larger number into max.
* At this point, max contains the largest of the first three numbers. Read the next number, compare it with max, and store the larger into max.

Repeat this process for each remaining number in the data set using a for expression.

Write a program using a function and a switch statement. The user should be prompted to enter a number in main. The function is called and the number entered is passed to the function. This function parameter will then be used in a switch to discover and print out the number word within the function (for example, 1=one, 2=two, 3=three, etc.).

Enter a number: 1
You entered the number one.

You may choose to limit the number entered by the user to a particular range. Be sure to prompt the user with this range, so you can deal with correct and incorrect numbers entered.

Solution Summary

The programs are properly commented to make it easier for you to understand.