题目在http://poj.org/problem?id=1028
我的代码如下:
#include
#include
#include
using namespace std;
int main()
{
unsigned current;
string userCommand;
vector webs;
webs.push_back("http://www.acm.org/");
while(getline(cin, userCommand))
{
if(userCommand.find("VISIT ") == 0)
{
webs.push_back(userCommand.substr(6));
current = webs.size() - 1;
cout << webs[current] << endl;
}
else if(userCommand == "BACK")
{
if(current == 0)
cout << "Ignored" << endl;
else
cout << webs[--current] << endl;
}
else if(userCommand == "FORWARD")
{
if(current == webs.size() - 1)
cout << "Ignored" << endl;
else
cout << webs[++current] << endl;
}
else if(userCommand == "QUIT")
break;
}
return 0;
}
求大神们帮我看看好不。。。。非常感谢