| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪里错了!!!头大根本找不到错一直RE#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<fstream>
using namespace std;
int main()
{
string a;
int position =0;
ifstream fin("input.txt");
vector<string>v;
v.push_back("http://www.acm.org/");
while(fin >> a)
{
if(a=="QUIT")
break;
if(a=="VISIT")
{
position++;
string b;
fin >> b;
v.insert(v.begin()+position,b);
int s=1;
while(position!=v.size()-1)
{
v.erase(v.begin()+position+s);
s++;
}
cout << b << endl;
}
if(a=="BACK")
{
position--;
if(position==-1)
{
position++;
cout << "Ignored" << endl;
}
else
cout << v[position] << endl;
}
if(a=="FORWARD")
{
position++;
if(position==v.size())
{
position--;
cout << "Ignored" << endl;
}
else
cout << v[position] << endl;
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator