日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Unit Three-Program test

發布時間:2023/12/4 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Unit Three-Program test 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

編程練習——《C Primer Plus》

Unit Three-Program test

Program_test_5

/* Program Test :一年大約有 3.156×10^7秒。編寫一個程序,提示用戶輸入年齡,然后顯示該年齡對應的秒數。 */ #include<stdio.h> int main(void) {int i_age;double d_seconds;double d_year = 3.156E7;printf("Please input your age:\n");scanf("%d",&i_age);d_seconds = i_age * d_year;printf("The years transfer into seconds of your age is %.2f", d_seconds);return 0; }

Program_test_7

/*Program Test 7 1英寸相當于 2.54 厘米。 編寫一個程序,提示用戶輸入年齡 然后顯示該年齡對應的描述。 */ #include<stdio.h> int main(void) {double d_inchs, d_height;printf("Please input your height(by inchs):\n");scanf("%lf",&d_inchs); //double型 scanf()函數要用 %lf d_height = d_inchs*2.54;printf("Your height is: %.2f by centimeters.\n",d_height); // printf() 函數中 float 和 double 都可以用 %f return 0;}

Program_test_8

/*Program Test 8 在美國的體積測量系統中; 1品脫等于2杯;1杯等于8蠱司;1蠱司等于2大湯勺;1大湯勺等于3茶勺; 編寫一個程序,提示用戶輸入杯數; 并以品脫、蠱司、湯勺、茶勺為單位顯示等價容量。 */ #include <stdio.h> int main(void) {float pints, cups, ounces, tablespoons, teaspoons ;printf("Please input some cups:");scanf("%f", &cups);pints = cups/2;ounces = cups*8;tablespoons = ounces*2;teaspoons = tablespoons*3;printf("%.2f,%.2f,%.2f,%.2f",pints,ounces,tablespoons,teaspoons);return 0; }

總結

以上是生活随笔為你收集整理的Unit Three-Program test的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。