1061 - cout << "Ignored" <<endl; }...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> #include<string> # using namespace std; u string forward[108]; string backward[108]; int flen, blen; i string current; s int main(){ int num; string cmd; cin>>num; while(num--){ current = "http://www.acm.org/"; blen = 0; flen = 0; for(;;){ cin>>cmd; if(cmd[0] == 'V'){ // Visit backward[blen ++] = current; flen = 0; cin>>current; cout<< current <<endl; } else if(cmd[0] =='B'){ // Back if(blen == 0){
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout << "Ignored" <<endl; } else { forward[flen ++] = current; current = backward[--blen]; cout<< current <<endl; } } else if(cmd[0] =='F'){ // Forward if(flen ==0){ cout << "Ignored" <<endl; } else { backward[blen ++] = current; current = forward[--flen]; cout<< current <<endl; } } else { // Quit break; } } if(num) cout<<endl; } return 0; }...
View Full Document

This note was uploaded on 02/18/2010 for the course CS 100 taught by Professor Acm during the Spring '10 term at Zhejiang University.

Ask a homework question - tutors are online