| ||||||||||
| 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 | |||||||||
我的也是测试没问题,但就是wrong Answer,各位有劳帮小弟一把。这里先谢过了!!!!!!#include<iostream.h>
#include<string.h>
#include<stdlib.h>
int const StackMaxSize=100;
struct Stack
{
char stack[StackMaxSize][80];
int top;
};
void Push(Stack & S,const char item[],int n)
{
S.top++;
strcpy(S.stack[S.top],item);
}
char* Pop(Stack & S,char a[],int n)
{
a=S.stack[S.top];
S.top--;
return a;
}
Stack Sb,Sf;
void main()
{
Sb.top=Sf.top=-1;
char *a=new char [80];
strcpy(a,"http://www.acm.org/ ");
char p[80]="";
cin.getline(p,80);
while(strcmp(p,"QUIT")!=0)
{
if(p[0]=='V')
{
while(Sf.top!=-1)
Sf.top--;
Push(Sb,a,80);
strcpy(a,(p+6));
for(int i=0;i<(int)strlen(a);i++)
cout<<a[i];
cout<<endl;
}
else if(p[0]=='B')
{
if(Sb.top==-1)
cout<<"Ignored"<<endl;
else
{
Push(Sf,a,80);
a=Pop(Sb,a,80);
for(int i=0;i<(int)strlen(a);i++)
cout<<a[i];
cout<<endl;
}
}
else if(p[0]=='F')
{
if(Sf.top==-1)
cout<<"Ignored"<<endl;
else{
Push(Sb,a,80);
a=Pop(Sf,a,80);
for(int i=0;i<(int)strlen(a);i++)
cout<<a[i];
cout<<endl;
}
}
cin.getline(p,80);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator