#include #include #include #define MAXINPUTARRAY 1000 #define MAXKNOWN 30 #define MAXROW 40 #define CMDLIST 4 #define CMDCOUNT 6 int it_is_what(wchar_t ch); int main(){ setlocale(LC_ALL, ""); wchar_t massive[MAXINPUTARRAY] = {0}; wchar_t knownint[MAXKNOWN] = {0}; int CellsInMainArray = 0; { // GET ALL INPUT wchar_t ch; while((ch = getwchar()) != WEOF){ massive[CellsInMainArray]=ch; CellsInMainArray++; if(CellsInMainArray>=MAXINPUTARRAY) return 1100; } } { // IS X(LETTER) EXISIST? int k = 0; while(k++ < CellsInMainArray){ if((massive[k] >= 'a' && massive[k] <= 'z') && massive[k+1]==' ' && !(massive[k-1] >= 'a' && massive[k-1] <= 'z')){ int mark = 1; for(int i = 0;iMAXINPUTARRAY)return 0; } { // TEST FOR COMMENT AND \t \n ' ' { if(row[0]=='#'){ int i = 0; putwchar('/');putwchar('/'); while(i++ < rowCursor)putwchar(row[i]); putwchar('\n'); continue; } } { int i = 0; if(row[0] == WEOF) return 0; if(rowCursor<4){ while(i < rowCursor) putwchar(row[i++]); continue;} } { while(row[0]=='\t' || row[0] == ' '){ putwchar(row[0]); for(int i = 0;i 0: { // PRINT PRE LETTERS wchar_t word[] = L"if("; int i = 0; while(word[i]!='\0')putwchar(word[i++]); } { // IF FUNC int xpos = 3; putwchar(row[xpos]);// x putwchar(row[xpos+2]);// > // >= int tmp = 0; if(it_is_what(row[xpos+3])==8){putwchar(row[xpos+3]);tmp++;} // NUM for(int i = xpos+4+tmp;i 0) case 2:{ // WHILE while i < 10: { // PRINT PRE LETTERS wchar_t word[] = L"while("; int i = 0; while(word[i]!='\0')putwchar(word[i++]); } { // WHILE FUNC int xpos = 6; putwchar(row[xpos]);// i putwchar(row[xpos+2]);// > // >= int tmp = 0; if(it_is_what(row[xpos+3])==8){putwchar(row[xpos+3]);tmp++;} // NUM for(int i = xpos+4+tmp;i='a'&&ch<='z')return 0; if(ch>='A'&&ch<='Z')return 1; if(ch>='0'&&ch<='9')return 2; if(ch == '=' || ch == '>' || ch == '<' || ch == '!')return 8; if(ch == '*' || ch == '-' || ch == '+' || ch == '/')return 9; if(ch == '\\' || ch == '\"' || ch == '\'')return 11; if(ch == '%')return 12; return -1; }