#include <stdio.h>
#define PRINT(format,x) printf("x = %"#format"\n",(x))
//how to add the # ????
int integer = 5;
char character = '5';
char *string = "5";

int main(void)
{
    PRINT(d,string); PRINT(d,character); PRINT(d,integer);
    PRINT(d,string); PRINT(c,character); PRINT(c,integer=53);
    PRINT(d,('5'>5));
    {
        int sx = -8;
        unsigned ux = -8;
        PRINT(o, sx); PRINT(o, ux);
        PRINT(o, sx>>3); PRINT(o, ux>>3);
        PRINT(d, sx>>3); PRINT(d, ux>>3);

    }

}
#include <stdio.h>

#define PR(x) printf(#x" = %.8g\t",(double)x)
#define NL putchar('\n')
#define PRINT4(x1,x2,x3,x4) PR(x1); PR(x2); PR(x3); PR(x4); NL

int main(void)
{
    double d;
    float f;
    long l;
    int i;
    i = l = f = d = 100/3; PRINT4(i,l,f,d);
    d = f = l = i = 100/3; PRINT4(i,l,f,d);
    i = l = f = d = 100/3; PRINT4(i,l,f,d);
    d = f = l = i = (double)100/3;
    PRINT4(i,l,f,d);
    i = l = f = d = (double)(100000/3);
    PRINT4(i,l,f,d);
    d = f = l = i = 100000/3;
    PRINT4(i,l,f,d);


}
#include <stdio.h>
#define PR(x) printf(#x" = %g\t",(double)(x))
#define NL putchar('\n')
#define PRINT1(x1) PR(x1); NL
#define PRINT2(x1,x2) PR(x1); PRINT1(x2);

int main(void)
{
    double d=3.2,x;
    int i=2, y;
    x = (x=d/i)*2; PRINT2(x,y);
    y = (x=d/i)*2; PRINT2(x,y);
    x = d*(x=2.5/d); PRINT1(y);
    x = d*(y=((int)2.9+1.1)/d); PRINT2(x,y);
}
posted on 2012-08-09 12:54  abacuspix  阅读(208)  评论(0编辑  收藏  举报