I'm trying to write a program to count and display the heights of students taller than 60 inches. For example: I need it to count and display the number of students taller than 60 inches and display their respective heights. I am unsure of how to store the separate values and display their height. I have gotten the program to count the number of students taller than 60 inches, but I need help displaying their specific height.
#include <iostream>
using namespace std;
int main()
{
double count60 = 0.0;
double height[10];
for (int x = 0; x < 10; x = x + 1)
{
height[x] = 0.0;
}
cout << "You are asked to enter heights of 10 students. "<< endl;
for (int x = 0; x < 10; x = x + 1)
{
cout << "Enter height of a student: ";
cin >> height[x];
if (height[x] > 60)
{
count60 = count60 + 1;
}
}
cout << "The number of students taller than 60 inches: "<< count60 << endl;
cout << "The heights of these students are: "
system("pause");
return 0;
}