我的題目被助教A走了, 因為早上印的不夠發...
看看阿錯還是 bala 你們有權限的, 能不能幫我補上去. :)
還有, 現在不解釋了.
一來是這個要花太久時間...
再來是有興趣的自己看, 看不懂的再問, 效果會比較好.
E1) # include <stdio.h>
# include <stdlib.h>
int main()
{
char s[80 + 1];
printf("What's your name?\n");
if (scanf("%[^\n]", s) < 1)
exit(1);
printf("Your name is %s.\n", s);
return 0;
}
E2) # include <stdio.h>
# include <stdlib.h>
int main()
{
double l, w;
double area, len;
printf("Please enter the length and width of an rectangle.\n");
if (scanf("%lf %lf", &l, &w) < 2)
exit(1);
area = l * w, len = 2 * (l + w);
printf("area = %.3f, len = %.3f\n", area, len);
return 0;
}
E3) # include <stdio.h>
# include <math.h>
int main()
{
printf("sqrt(2.0) == %f\n"
"log10(2.0) == %f\n"
"fabs(2.0) == %f\n"
"pow(2.0, 32.0) == %f\n",
sqrt(2.0), log10(2.0),
fabs(2.0), pow(2.0, 32.0)
);
return 0;
}
--
新詩練習:新鮮。踩破初春裡的狗大便;不經意的滄桑,滿溢著嫩黃的喜悅。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.224.160.158
※ 編輯: Muscovy 來自: 61.224.160.158 (03/13 13:07)