[ create a new paste ] login | about

Link: http://codepad.org/bWiSIXgm    [ raw code | fork ]

C, pasted on Jan 15:
#include<stdio.h>

void input(void);
void show0(void);
void show1(void);
void show2(void);
void show3(void);

int x, y;

int main(void)
{
	void (*pM[5])(void);
	int num;
	pM[0] = input;
	pM[1] = show0;
	pM[2] = show1;
	pM[3] = show2;
	pM[4] = show3;

	for(num=0;num<5;num++){
		(*pM[num])();
	}
	return 0;
}

void input(void){
printf("1つ目の整数数値入力\n");
scanf("%d", &x);

printf("2つ目の整数数値入力\n");
scanf("%d", &y);
}

void show0(void)
{
	printf("加算結果は%dです\n", x + y);
}

void show1(void)
{
	printf("減算結果は%dです\n", x - y);
}
void show2(void)
{
	if (x > y)
		printf("最大値は%dです\n", x);
	else
		printf("最大値は%dです\n", y);
}
void show3(void)
{
	if (y < x)
		printf("最小値は%dです\n", y);
	else
		printf("最小値は%dです\n", x);
}


Create a new paste based on this one


Comments: