找错,最后一个输出不对
#include<stdio.h>int main()
{
float h, r, l, s, sq, vq, vz;
float pi = 3.141526;
printf("请输入圆半径r,圆柱高h:");
scanf_s("%f,%f", &r, &h);
l = 2 * pi * r;
s = r * r * pi;
sq = 4 * pi * r * r;
vq = 3.0 / 4.0 * pi * r * r * r;
vz = pi * r * r * h;
printf("圆周长为: l=%6.2f\n", l);
printf("圆面积为: s=%6.2f\n", s);
printf("圆球表面积为: sq=%6.2f\n", sq);
printf("圆球体积为: v=%6.2f\n", vq);
printf("圆柱体积为: vz=%6.2f\n", vz);
return 0;
}
还有一个:
#include<stdio.h>
int main()
{
char c1, c2;
int i1, i2;
printf("请输入两个字符 c1,c2:");
scanf_s("%c,%c", &c1, &c2);
i1 = c1;
i2 = c2;
printf("按字符输出结果:\n");
printf("%c,%c\n", i1, i2);
printf("按整数输出结果:\n");
printf("%d,%d\n", c1, c2);
return 0;
}
[此贴子已经被作者于2020-11-11 17:36编辑过]