#include<stdio.h>
int main()
{
int ch = 0;
int count = 0;
while((ch=getchar()) !=EOF)
{
if((ch == '}') && (count==0))
{
printf("不匹配\n");
return 0;
}
else if((ch == '}')&&(count !=0))
{
count--;
}
else if(ch == '{')
{
count++;
}
}
if(count == 0)
{
printf("匹配\n");
}
else
{
printf("不匹配\n");
}
system("pause");
return 0;
}
{}花括号的匹配
最新推荐文章于 2024-07-15 02:45:37 发布