#include
#include
int main(void)
{
int cp=0,maxp=0;
char site[110][80];
char commond[10];
strcpy(site[0],"http://www.acm.org/");
scanf("%s",commond);
while(strcmp(commond,"QUIT")!=0)
{
if(strcmp(commond,"VISIT")==0)
{
cp++;
//你这里错了,就是下面一行
maxp=cp;
scanf("%s",site[cp]);
printf("%s\n",site[cp]);
}
else if(strcmp(commond,"BACK")==0)
{
cp--;
if(cp<0)
{
printf("Ignored\n");
cp++;
}
else
{
printf("%s\n",site[cp]);
}
}
else if(strcmp(commond,"FORWARD")==0)
{
cp++;
if(cp>maxp)
{
printf("Ignored\n");
cp--;
}
else
{
printf("%s\n",site[cp]);
}
}
scanf("%s",commond);
}
return 0;
}
#include
#include
int main(void)
{
int cp=0,maxp=0;
char site[110][80];
char commond[10];
strcpy(site[0],"http://www.acm.org/");
scanf("%s",commond);
while(strcmp(commond,"QUIT")!=0)
{
if(strcmp(commond,"VISIT")==0)
{
cp++;
if(cp>maxp)maxp++;
scanf("%s",site[cp]);
printf("%s\n",site[cp]);
}
else if(strcmp(commond,"BACK")==0)
{
cp--;
if(cp<0)
{
printf("Ignored\n");
cp++;
}
else
{
printf("%s\n",site[cp]);
}
}
else if(strcmp(commond,"FORWARD")==0)
{
cp++;
if(cp>maxp)
{
printf("Ignored\n");
cp--;
}
else
{
printf("%s\n",site[cp]);
}
}
scanf("%s",commond);
}
return 0;
}(%不通过干死你)
#include top++;
void main(){
char t[110][110]={"http://www.acm.org/"};
char s[70];
int top=0,p=0,f=0;
while(1){
scanf("%s",s);
switch (s[0]){
case 'V':
p=++top;
scanf("%s",t[top]);
printf("%s\n",t[top]);
break;
case 'B':
if(top>0){
top--;
printf("%s\n",t[top]);
}
else printf("Ignored\n");
break;
case 'F':
if(top
printf("%s\n",t[top]);
}
else printf("Ignored\n");
break;
case 'Q':
f=1;
break;
}
if(f)break;
}
}
我ac的,你先看看,现在忙.等有时间我再看你的
我可以直接通过你的程序啊,没问题的