好吧,所以我想读输入到一个向量,然后按相反的顺序打印出来。 我有一个相当不错的想法如何做到这一点(我认为),但我的问题是,我的代码只读取用户输入到矢量的第一个插槽。 。 。我需要它从输入读取10个单独的字符串到我的向量中的10个不同的插槽。 。 。这里是我到目前为止有:没有输入输入矢量
#include <iostream>;
#include <vector>;
#include <string>;
using namespace std;
int main()
{
vector<string> name_list(11);
int n = 0;
for (int n = 0; n < 11; ++n);
getline(cin, name_list[n]);
cout << name_list[0];
int stop;
cin >> stop;
return 0;
}