第四章 1.
#include
char ming[20],xing[20];
printf(\); scanf_s(\, ming,20); scanf_s(\, xing,20);
printf(\, ming, xing); return 0;
2.
#include
char name[40]; int width;
printf(\); scanf_s(\, name,40); printf(\, name); printf(\, name); printf(\, name); width = strlen(name) + 3; printf(\, width, name); return 0;
3.
#include
float num;
printf(\); scanf_s(\, &num);
printf(\,num, num); printf(\, num, num); return 0;
4.
#include
char name[40]; float height;
printf(\); scanf_s(\, name, 40, &height);
printf(\, name, height/12); return 0;
5.
#include
printf(\, ming, xing); printf(\, b, b, a, a); return 0;
printf(\); scanf_s(\, ming, 40);
printf(\); scanf_s(\, xing, 40); a = strlen(xing); b = strlen(ming);
printf(\, ming, xing); printf(\, b, b, a, a); char xing[40], ming[40]; int a, b;
6.
#include
double a = 1.0/3.0; float b = 1.0/3.0;
printf(\, a, a, a); printf(\, b, b, b); printf(\, FLT_DIG);
}
printf(\, DBL_DIG); return 0;
7.
#include
double mile, petrol, milespergallon,LKM; printf(\); scanf_s(\, &mile); printf(\); scanf_s(\, &petrol); milespergallon = mile / petrol;
LKM = 100 * petrol * gallitre / (mile * mikm); printf(\, milespergallon); printf(\, LKM); return 0;