- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
The C Language
The C Language History of C 西 元 1960 年 Algo 60 語 言 ( International Committe ) 西 元 1963 年 CPL 語 言 ( 劍 橋 與 倫 敦 大 學 ) 西 元 1966 年 BCPL 語 言 下 ( 劍橋大學 Martin Richards ) 西 元 1970 年 B 語 言 ( ATT Ken Thompson ) 西 元 1972 年 C 語 言 ( ATT Dennis Ritchie ) Program I : The happiness is… #include stdio.h #include stdlib.h int main( ) { printf(「幸福」就是… ); printf(每天晚上能一覺到天亮!\n ); system(PAUSE); return 0; } 執行結果 Program II : 5 + 7 = ? 執行結果 #include stdio.h #include stdlib.h int main() { int a, b, c; a = 5; b = 7; c = a + b; printf(%d + %d = %d\n, a, b, c); system(PAUSE); return 0; } a b c 5+7 5 7 12 Program III : How old are you ? #include stdio.h 執行結果 #include stdlib.h int main( ) { int myage; myage = 16; printf(I am %d years old. \n, myage); printf(Next year, I will be %d years old. \n, myage+1); system(PAUSE); return 0; } How printf( ) work? printf(Hello); printf(Hello\n); printf(%d, b); printf(The temperature is ); printf(%d, b); printf( degrees\n); printf(The temperature is %d degrees\n, b); printf(%d + %d = %d\n, a, b, c); 資料型態 (character, 字元) char (integer, 整數) int (long integer, 長整數) long (short integer, 短整數) short (浮點數) float (倍精度浮點數) double 佔1 byte 佔4 bytes 佔4 bytes 佔2 bytes 佔4 bytes 佔8 bytes How printf( ) work? int (整數) uses %d float (浮點數) uses %f char (字元) uses %c character strings(字串)use %s 變數 變數名稱要有意義,以增加程式的可讀性。(如num表數字、stud表學生人數) 變數名稱的限制: 不能使用C語言的關鍵字。 變數名稱的有效長度是前八位元。 可以是英文字母、數字或底線。 不能有空白字元。 第一個字元不能是數字。 計算圓面積 計算攝氏溫度轉華氏溫度 已知:(輸入) 攝氏溫度 C = 25; 求: 華氏溫度 F 運算式:(公式 F = 9/5 * C + 32) F = (float)C * 9 / 5 + 32; 輸出:華氏溫度 F 值為 xx.xx (%.2f) 計算BMI (一) 已知:(輸入) 身高 height = 168; 體重 weight = 55; 求:BMI 運算式: BMI = weight / (height)2 (身高單位為公尺、體重單位為公斤。) BMI = weight/(height*height/10000); 輸出:你的 BMI 值為xx.xx (%.2f) 執行結果 Program IV : a + b = ? 執行結果 #include stdio.h #include stdlib.h int main() {
您可能关注的文档
- lifengxiang.ppt
- M4U5 Reading.ppt
- M6U1 Reading---Stand up for your health.ppt
- Machine DiscoveryProject.ppt
- Low carbon,.ppt
- Magnetic sensors and logic gates.ppt
- mahailingsiyue@126.com.ppt
- Male Factor Infertility, Semen Quality and Environmental Factors.ppt
- Lookback Options.ppt
- MAS 500 Migration Troubleshooting.ppt
- The Champion of the Contest will be…YOU.ppt
- T2-1019kqyan@cyut.edu.twext 42010935797839.ppt
- Term ProjectFinal Presentation.ppt
- The Hammerhead Ribozyme.ppt
- The Basics of X-Ray Timing.ppt
- The Challenging Friend I Didn't Know.ppt
- The Thatcher Era.ppt
- The Youth Risk Behavior Surveillance System (YRBSS)2013.ppt
- The Four Seasons说课:肖瑶讲课:张伟 评课:胡传娥.ppt
- The heart is slow to learn.ppt
文档评论(0)