回复 23楼 TonyDeng
一开始就这个样子的,我觉着有小数,就用了double。但是编译的时候有错。就改成后开的long了
/* Program is 2.2 习题 */
#include <stdio.h>
int main(void)
{
double Long = 0;
\\fang jian de chang
double kuan = 0;
\\fang jian de kuan
double feet = 0;
double inches = 0;
double mianji = 0;
\\fang jian de mianji
const long inches_per_foot = 12L;
const long yard_per_foot = 3L;
// long de chang du
printf("shu ru fang jian de Long in whole feet: ");
scanf("%ld", &feet);
printf("
...and then inches: ");
scanf("%ld", &inches);
Long = feet*inches_per_foot+inches;
// kuan de chang du
printf("shu ru fang jian de kuan in whole feet: ");
scanf("%ld", &feet);
printf("
...and then inches: ");
scanf("%ld", &inches);
kuan = feet*inches_per_foot+inches;
//fang jian de mian ji
mianji = Long*kuan
printf("fang jian de mianji is %.2ld feet and %.2ld inches.\n", mianji/yard_per_foot,mianji%yard_per_foot);
return 0;