Answer to Question #45389 in C++ for Madzkie Sarion

Question #45389
Problem Description Given a set of integers Print out the maximum per line. The first number per line indicates the number of integers following it. The first number per line should not be included in the process. Input zroeD.in Output standard output Sample Input 4 6 5 4 7 9 2 6 5 8 4 5 7 3 6 7 4 2 5 7 3 4 3 Sample Output 7 8 7
1
Expert's answer
2014-08-28T05:24:47-0400
#include <iostream>
int main() {
int quantity;
std::cin >> quantity;
int array[quantity];
for ( int i = 0; i < quantity; i++ ) {
std::cin >> array[i];
}
int max = array[0];
for ( int i = 0; i < quantity; i++ ) {
if ( array[i] > max ) {
max = array[i];
}
}
std::cout << max << std::endl;
}

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 first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal