1. 程式人生 > >個人碼風

個人碼風

tdi while lse fin ++i 空格 inf else const

大括號不換行

int f(int x){
    ...
}

運算符之間打空格

if(a + b > c && d - e <= f)

逗號後打空格

int a, b, c;

函數縮進4格,for縮進3格,if,else,while,switch縮進2格

int f(x){
    for(int i = 1; i <= n; ++i)
       if(i % 2 == 0)
         while(i % 2 == 0)
           i /= 2;
    return 233;
}

喜歡用#define

#define lowbit(x) (x & (-x))
#define INF 2147483647
#define ll long long
#define left (now << 1)
#define right (now << 1 | 1)
#define Open(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout);
#define Close fclose(stdin); fclose(stdout);

常量名全大寫

const int MAXN = 100010;

個人碼風