#include #include #include #include int proverka(char *a) {int i,s=0; if(a[0]=='(') s++; if((a[0]<'0'||a[0]>'9')&&(a[0]!='+'&&a[0]!='-'&&a[0]!='(')) {printf("error33"); free(a); return 1; } for(i=1;a[i]!='=';i++) {if(a[i]=='(') s++; else if(a[i]==')'){ s--;if(s<0){ printf("error3");free(a);return 1; }} else {if(a[i]=='+'||a[i]=='-'||a[i]=='*'||a[i]=='/') {if((a[i-1]<'0'||a[i-1]>'9')&&a[i-1]!=')') {printf("error1"); free(a); return 1; } } else if(a[i]<'0'||a[i]>'9') {printf("error3"); free(a); return 1; } } } if(s!=0) {printf("error3"); free(a); return 1; } } char* slojenie(int i1, int i2, char *a) {int i,w=0,j; char *sl; if(i1>=i2-i1-2) {sl=(char *)realloc(sl,i1+1); for(i=i1;i>-1;i--) {//printf("<%c> ",a[i]+a[i2-i1+i]+w-'0'); //getch(); (a[i]+a[i2-i1+i]-'0'>'9')?(sl[i]=a[i]+a[i2-i1+i]+w-10-'0',w=1):(sl[i]=a[i]+a[i2-i1+i]+w-'0',w=0); } } for(i=0;i1) { realloc(buff,(s4et=s4et-2)+1); if(wherex()==1) {gotoxy(80,wherey()-1); printf(" "); gotoxy(80,wherey()-1); } else { printf("%c %c",8,8);} } else {printf("%c",buff[s4et]); } } printf("\n"); for(i=0;i<=s4et;i++) {printf("%c",buff[i]); } proverka(buff); war(buff); } else if(x==25) {free(buff); return 0; } } else if(s4et<77) { if(y==6) { if(x==3) // esli kursor nahoditsya na klavishi "1" { gotoxy(3+s4et,2); s4et++; printf("1"); buff=(char *)realloc(buff,s4et+1); if(buff==NULL) {printf("out of memory"); getch(); free(buff); return 0; } buff[s4et]='1'; } else if(x==6) { gotoxy(s4et+3,2); printf("2"); s4et++; buff=(char *)realloc(buff,s4et+1); if(buff==NULL) {printf("out of memory"); getch(); free(buff); return 0; } buff[s4et]='2'; } else if(x==9) { gotoxy(s4et+3,2); printf("3"); s4et++; buff=(char *)realloc(buff,s4et+1); if(buff==NULL) {printf("out of memory"); getch(); free(buff); return 0; } buff[s4et]='3'; } } else if(y==9) { if(x==3) {gotoxy(s4et+3,2); printf("4"); s4et++; buff=(char *)realloc(buff,s4et+1); if(buff==NULL) {printf("out of memory"); getch(); free(buff); return 0; } buff[s4et]='4'; } else if(x==6) {gotoxy(s4et+3,2); printf("5"); s4et++; buff=(char *)realloc(buff,s4et+1); if(buff==NULL) {printf("out of memory"); getch(); free(buff); return 0; } buff[s4et]='5'; } else if(x==9) {gotoxy(s4et+3,2); printf("6"); s4et++; buff=(char *)realloc(buff,s4et+1); if(buff==NULL) {printf("out of memory"); getch(); free(buff); return 0; } buff[s4et]='6'; } else if(x==12) {gotoxy(s4et+3,2); printf("+"); s4et++; buff=(char *)realloc(buff,s4et+1); if(buff==NULL) {printf("out of memory"); getch(); free(buff); return 0; } buff[s4et]='+'; x1=s4et-1; } else if(x==15) {gotoxy(20,20); for(i=0;i