60 696
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #45441 in C++ for paolo david

Question #45441
Write a program that asks the user to type 10 integers and write the number of occurrence
of the biggest value
do while program,.
c++
Expert's answer
#include <iostream>
int main() {
int *array = new int[10];
int max, i = 0, count = 0;
std::cout << "Input 10 integers" << std::endl;
do{
  std::cin >> array[i];
  i += 1;
} while (i < 10);
max = *array;
i = 0;
do{
  if (array[i] > max) {
max = array[i];
  }
  i += 1;
} while (i < 10);
i = 0;
do{
  if (array[i] == max) {
count += 1;
  }
  i += 1;
} while (i < 10);
std::cout << "Max value is " << max << ". You can see it " << count << " times in the array" << 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

Submit
Privacy policy Terms and Conditions