Answer to Question #20849 in C++ for Stephon

Question #20849
Write a program using while structure that allows you to enter 10 integer numbers and it prints out the largest of the numbers after completion of the entry.
Counter : Keeps the count of the entry
Number : Current number input into the program
Largest : The largest number found .
1
Expert's answer
2012-12-19T11:17:15-0500
#include <iostream>
#define Counter 10

using namespace std;

int main(int argc, const char * argv[])
{
int i=1,number,largest=0;

while (i<=Counter) {
&
& cin>>number;
&
& if (largest<number) {
largest = number;
& }
& ++i;
}
cout << largest;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS