谁知道这段代码什么意思?(急求)

来源:百度知道 编辑:UC知道 时间:2024/06/25 05:39:55
#include<string>
#include<iostream>
#include<vector>
using namespace std;
int main()
{
double score;
vector<double> homework; // 空 vector

cout<<"Please enter the score of homework:\n"
"(Ctrl+Z to stop)"
<<endl;

while (cin >> score)
//只要输入数据满足要求就继续循环
homework.push_back(score);
// 将word加到text最尾

for (int ix=0; ix<homework.size(); ++ix)
cout<<homework[ix]<<endl;
return 0;
}
能否具体一点??

我猜:
homework类似字符数组

cout<<"Please enter the score of homework:\n"
"(Ctrl+Z to stop)"
<<endl;
这是输入任何东东都会作为输入,Ctrl+Z 结束输入(这应该是vector的原因)