C++/c++ programming
Expert: Zlatko - 8/20/2010
QuestionThe process of finding the largest number(i.e the maximum of a group of numbers) is used frequently in computer applications. For example, a program that determines the winner of a sales contest inputs the number of units sold by each salesperson. The salesperson who sells the most units wins the contest. Write a pseudocode program, then a c++ program that uses a while statement to determine and print the largest number of 10 numbers input by the user. Your program should use three variables, as follows:
counter: A counter to count to 10(to keep track of how many numbers have been input and to determine when all 10 numbers have been processed).
Number: The current number input to the program.
Largest: The largest number found so far.
AnswerHello Mayibongwe
With my previous answer to you, I showed you how to do input from the keyboard into variables. Use what I showed you there to start this program. Take the advice of the problem and create an integer variable for the counter. Number and Largest can be integers or doubles. The while loop should look like this :
counter = 0;
while (counter < 10)
{
// TODO add code to get input and check input against largest
++counter;
}
That, along with my previous answer should be enough of a hint. Show me an effort, and I'll help you more.
Kindest regards
Zlatko