Some novice code is not aware of the style, the code is not aligned indentation, such as the following code
#include <stdio.h>intMainvoid){ intI,n;ints =0; while(SCANF ("%d", &n)! =EOF) { for(i=1; i<=n;i++) s+=i;printf ("%d\n", s);} return 0;}
Visual C + +:
First, select all of your code (the form where the code is located, the shortcut key with CTRL + A), and then press ALT + F8 to get the following style code
#include <stdio.h>intMainvoid){ intI,n; ints =0; while(SCANF ("%d", &n)! =EOF) { for(i=1; i<=n;i++) s+=i; printf ("%d\n", s); } return 0;}
Codeblocks:
Click on the right mouse button in the Code window and a menu appears, click "Format use Astyle".
Get the code of the following style
#include <stdio.h>intMainvoid){ intI,n; ints =0; while(SCANF ("%d", &n)! =EOF) { for(i=1; i<=n; i++) s+=i; printf ("%d\n", s); } return 0;}
Generally speaking, Astyle is much more powerful, and can be customized in style. For example, the following code, VC + + 6.0 is not processed, and CB is very good
#include <stdio.h>intMainvoid){ intI,n; ints =0; while(SCANF ("%d", &n)! = EOF) { for(i=1; i<=n;i++) s+=i; printf ("%d\n", s); } return 0;}
Use the IDE to make your code style look good