I want to write a Java program, a work is in the form of C code input, and clear it (we know In that input, each row will not have more than one command.)
#include & lt; Stdio.h & gt; Int main () {int i, n; Float ARR [100]; Printf ("Enter Number:"); Scanf ("% d", & amp; n); Printf ("\ n"); (I = 0; i & lt; n; ++ i) for {printf ("% d", i + 1); Scanf ("% f", & amp; arrivals [i]); } (I = 1; i & lt; n; ++ i) {If (ARR [0] [arr]] arr [0] = arr [i]; } Printf ("largest% .2f", arr [0]); Return 0; }
It is clear that I mean. Tabs in place, no unnecessary spaces, etc. IDE usually does this, but I want to write a code to do it myself.
#include & lt; Stdio.h & gt; Int main () {int i, n; Float ARR [100]; Printf ("Enter Number:"); Scanf ("% d", & amp; n); Printf ("\ n"); (I = 0; i & lt; n; ++ i) for {printf ("% d", i + 1); Scanf ("% f", & arr [i]); } (I = 1; i & lt; n; ++ i) {If (ARR [0] [arr]] arr [0] = arr [i]; } Printf ("largest% .2f", arr [0]); Return 0; }
I do not know where it starts from. But I think I should split the material and redo the material, split the input into the first part, and then it should be parsed in some way. For example (how many tabs for each "{"} how many "{" are in each other), and such things should be counted 1) One pillar for each block 2) Other if one's "}" Comes directly after, or if there is no "}", then it comes in the next line 3) ";" (I = 0; i ++) {.. 4) There is no unnecessary space, after which it should be straight behind (no other place is different), also for this, is a place. 5) No empty line
No comments:
Post a Comment