Purchase Solution

Determining the Largest of 15 Numbers Given

Not what you're looking for?

Ask Custom Question

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

Hints:

* 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.

Purchase this Solution

Solution Summary

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

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

C# variables and classes

This quiz contains questions about C# classes and variables.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.