view test/simp1.c @ 492:cc1a5f764782

*** empty log message ***
author kono
date Wed, 21 Dec 2005 12:10:43 +0900
parents a379da780856
children a4445cb1aa91
line wrap: on
line source

int printf(const char *format, ...);


int
i(int a,int b,int c,int d,int f)
{
	printf("#0006:i(%d,%d,%d,%d,%d)\n",a,b,c,d,f);
	return a+b+c+d+f;
}

short
s(short a,short b,short c,short d,short f)
{
	printf("#0013:s(%d,%d,%d,%d,%d)\n",a,b,c,d,f);
	return a+b+c+d+f;
}

char
ch(char a,char b,char c,char d,char f)
{
	printf("#0020:ch(%d,%d,%d,%d,%d)\n",a,b,c,d,f);
	return a+b+c+d+f;
}


float
f(float a,float b,float c,float d,float f)
{
	printf("#0028:f(%g,%g,%g,%g,%g)\n",a,b,c,d,f);
	return a+b+c+d+f;
}

double
d(double a,double b,double c,double d,double f)
{
	printf("#0035:d(%g,%g,%g,%g,%g)\n",a,b,c,d,f);
	return a+b+c+d+f;
}

long long
l(long long a,long long b,long long c,long long d,long long f)
{
	printf("#0042:l(%lld,%lld,%lld,%lld,%lld)\n",a,b,c,d,f);
	return a+b+c+d+f;
}


int
i0()
{
	int a,b,c;
	a=3;
	b=-3;
	c=5;
	c = i(a*3,b*c,b+c,b/c,b-c);
	printf("#0055:int: %d\n",c);
}

int
g()
{
	float a,b,c;
	a=3.0;
	b=-3.0;
	c=5.0;
	c = f(a*3,b*c,b+c,b/c,b-c);
	printf("#0066:float: %g\n",c);
}

int
h()
{
	double a,b,c;
	a=3.0;
	b=-3.0;
	c=5.0;
	c = d(a*3,b*c,b+c,b/c,b-c);
	printf("#0077:double: %g\n",c);
}

int
h1()
{
	long long a,b,c;
	a=3;
	b=-3;
	c=5;
	c = l(a*3,b*c,b+c,b/c,b-c);
	printf("#0088:long long: %lld\n",c);
}

int
c1()
{
	char a,b,c;
	a=3;
	b=-3;
	c=5;
	c = ch(a*3,b*c,b+c,b/c,b-c);
	printf("#0099:char: %d\n",c);
}

int
s1()
{
	short a,b,c;
	a=3;
	b=-3;
	c=5;
	c = s(a*3,b*c,b+c,b/c,b-c);
	printf("#0110:short: %d\n",c);
}

main()
{
    i0();
    g();
    h();
    h1();
    return 0;
}