Автор: Prophet (13.12.2007 в 21:29)
В общем попробовал с вашей помощью написать сам. Подскажите, пожалуйста, есть ли у меня ошибки?
#include <stdio.h>
#include <conio.h>
main()
{
clrscr();
start: int i;
int x=0;
int y=0;
char str[30];
for(i=0;i<31;i++){
str[i]=0;
}
printf("Vvediete mateticheskoe virazhenie (ne bolee 30 simvolov):\n");
gets(str);
if (str[30]!=0){
printf("vi vveli bol`she 30 simvolov, poprobuite eshe raz\n");
goto start;
}
for(i=0;i<30;i++)
{
if(str[i]=='(') x++;
if(str[i]==')') y++;
}
if(x>y) {
x=x-y;
printf("Propusheno %d zakrivayushaya(ih) skobka(ok)\n", x);
}
else if(y>x) {
y=y-x;
printf("Propusheno %d otkrivayushaya(ih) skobka(ok)\n", y);
}
else if(x=y){
printf("Sootvetstvuet\n");
}
return 0;
}
|