#include <string>
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main()
{
vector<string> v;
ifstream in("Fillvector.cpp");
string line;
while (getline(in, line))
v.push_back(line);
for(int i = v.size()-1; i>=0; i--)
cout << i << ": " << v[i] << endl;
}
才发现我是多此一举,可以直接倒着输出啊
怪了...我也这么写的..可是就不行啊...
我写的是for( int i = v.size(); i>0; i--)