Hatton_0 2014-12-09 07:34 采纳率: 0%
浏览 1654
已采纳

vs2010中怎么经常报错!求助 !

#include
#include
#define STACK_SIZE 100
char contents[STACK_SIZE];
int top=0;

void make_empty(void);
int is_empty(void);
void stack_underflow(void);
void stack_overflow(void);
void push(char i);
int pop(void);
int is_full(void);

int main()
{
char a,c;
printf("Enter parenteses and/or braces:");

for(;;){
c=getchar();
if(c=='\n'){
    if(top==0){
        printf("匹配!\n");break;}
    else{
        printf("不匹配!\n");break;}}
else if(c=='{'||c=='('||c=='[')
    push(c);
else if(c=='}'||c==')'||c==']'){
    a=pop();
    if((c=='}' && a!='{')||(c==')' && a!='(')||(c==']' && a!='[')){
        printf("不匹配!!\n");break;}
else{
    printf("输入不正确");break;}}

}

void make_empty(void)
{
top=0;
}

int is_empty(void)
{
if(top==0)
return 1;
else
return 0;
}

int is_full(void)
{
if(top==STACK_SIZE)
return 1;
else
return 0;
}

void push(char i)
{
if(is_full())
stack_overflow();
else
contents[top++] = i;

}

int pop(void)
{
if (is_empty())
stack_underflow();
else
return contents[--top];

}

void stack_overflow(void)
{
printf("Stack Overflow\n");
printf("bupipei\n");
exit (0);
}

void stack_underflow(void)
{

printf("Stack Underflow\n");
exit (0);

}

1>c:\users\lenovo\documents\visual studio 2010\projects\20141126.c\20141126.c\596.c(42): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)

  • 写回答

4条回答 默认 最新

  • save4me 2014-12-09 09:18
    关注

    你的main部分少了右花括号"}"加上就可以了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮