我正在尝试编写一个程序来计算和显示身高超过 60 英寸的学生的身高。例如:我需要它来统计和显示身高超过 60 英寸的学生人数并显示他们各自的身高。我不确定如何存储单独的值并显示它们的高度。我已经让程序计算身高超过 60 英寸的学生人数,但我需要帮助来显示他们的具体身高。
#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;
}