poj1028

//============================================================================
// Name        : 1028.cpp
// Author      : sww
// Version     : 1.0
// Time	       : 2013-11-18 20:37:20
//===========================================================================

#include <stdio.h>
#include <string.h>
using namespace std;

#define M 102
#define L 71
char data[M][L];
char command[8];

int main() {
	char org[] = "http://www.acm.org/";
	strcpy(data[0], org);
	int index = 0;
	int size = 1;

	while (true) {
		scanf("%s", command);
		if (command[0] == 'Q')
			break;
		switch (command[0]) {
		case 'V':
			index++;
			scanf("%s", data[index]);
			puts(data[index]);
			size = index + 1;
			break;
		case 'B':
			if (index>0){
				index --;
				puts(data[index]);
			}else{
				puts("Ignored");
			}
			break;
		case 'F':
			if (index< size-1){
				index++;
				puts(data[index]);
			}else{
				puts("Ignored");
			}
			break;
		}
	}

	return 0;
}

猜你喜欢

转载自blog.csdn.net/swwlqw/article/details/16810335
今日推荐