iq2.c

来自「C.Game.Programming.For.Dummies原码」· C语言 代码 · 共 36 行

C
36
字号
#include <stdio.h>
#include <stdlib.h>

int getval(void);

void main()
{
	int age,weight,area;
	float iq;

	printf("Program to calculate your IQ.\n");
	printf("Enter your age:");
	age=getval();
	printf("Enter your weight:");
	weight=getval();
	printf("Enter the your area code:");
	area=getval();

	iq=(float)(age*weight)/area;
	printf("This computer estimates your IQ to be %f.\n",iq);
}

int getval(void)
{
	char input[20];
	int x;

	x=atoi(gets());
	return(x);
/*
	gets(input);
	x=atoi(input);
	return(x);
*/
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?