标签:c语言
#include<stdio.h>
#include<process.h>
int main()
{
char c = 0;
int count = 0;
while ((c = getchar()) != EOF)
{
if (c == ‘{‘)
{
count++;
}
else if (c == ‘}‘&&count == 0)
{
printf("花括号不匹配!");
return 0;
}
else if (c == ‘}‘&&count!=0)
{
count--;
}
}
if (count == 0)
printf("花括号匹配");
else
printf("花括号不匹配!");
system("pause");
return 0;
}
标签:c语言
原文地址:http://lingdandan.blog.51cto.com/10697032/1696819