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条)

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题