c please thx Write a program that prompts users for N intege

c++ please. thx

Write a program that prompts users for N integers and determines displays the integer with the highest/lowest value - use separate functions to return the highest/lowest value.

Solution

Answer:

C++ Program :

#include <iostream>
using namespace std;
int main()
{
float input;
float minimum_value, maximum_value;
  
cout << \"Enter a value or any negative integer to terminate: \";
cin >> input;
minimum_value = input;
maximum_value = input;
while (input >= 0.0)
{
  
if (input > maximum_value)
maximum_value = input;
else if (input < minimum_value)
minimum_value = input;

cout << \"Enter a value or any negative integer to terminate: \";
cin >> input;
}


cout << \"Minimum value of entered values are : \" << minimum_value << endl;
cout << \"Maximum value of entered values are : \" << maximum_value << endl;
  
return 0;
}

Output:

Enter a value or any negative integer to terminate: 5
Enter a value or any negative integer to terminate: 8
Enter a value or any negative integer to terminate: 9
Enter a value or any negative integer to terminate: 5
Enter a value or any negative integer to terminate: 4
Enter a value or any negative integer to terminate: 3
Enter a value or any negative integer to terminate: -7
Minimum value of entered values are : 3
Maximum value of entered values are : 9

c++ please. thx Write a program that prompts users for N integers and determines displays the integer with the highest/lowest value - use separate functions to

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site