填空题
输入一字符串str,判断其中“(”与“)”是否配对,即“(”与“)”个数相等,且从第一个字符开始,任何时候“)”的个数都不超过“(”的个数。
#include<stdio.h>
int main()
{
char str[81], *p=str;
int k=0;
gets(str);
while(*p!=0)
{
if(
1)
k++;
else if(*p==")")
2;
if(k<0)
break;
p++;
}
if(
3)
printf("RIGHT/n"); /*配对*/
else
printf("ERROR/n"); /*不配对*/
return 0;
}