- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
程式 隨便寫 隨便對? 蔡文能 tsaiwn@.tw 交通大學資訊工程學系 Agenda 印出根號 2 /* 寫個程式印出根號2 */ #includestdio.h double sqrt(double); // #includemath.h int main( ) { printf( sqrt 根號 2 =%f\n , sqrt(2.0) ); // C++ 式的註解 comment printf(Bye bye!\n); return 0; } 印出根號 3 /* 寫個程式印出根號3 */ #includestdio.h double sqrt(double); // #includemath.h int main( ) { printf( sqrt 根號 3 =%f\n , sqrt(3.0) ); // C++ 式的註解 comment printf(Bye bye!\n); return 0; } 印出根號 x /* 寫個程式印出根號 x */ #includestdio.h #includemath.h double y; int main( ) { printf( Give me x : ); scanf(%lf , y); printf(Sqrt(%f)=%f\n, y, sqrt(y) ); return 0; } 程式 隨便寫 求 x 的平方根 p3.c – 練習 while loop #include stdio.h #include math.h int main() /* This program can find square root of any number that =0 and will stop when you enter a value that 0 阿版權是蔡文能的, 歡迎拷貝分享初學者! */ { float onevar; /* 變數名稱隨便我取的啦 */ double ans; /* 用來放答案 */ printf(Find square root of X. Negative value will cease the program\n); printf(X=? ); /* 還是問X=? 比較簡潔有力, 不用說onevar */ scanf(%f, onevar); while(onevar =0 ) { /*只要onevar大於或等於零我們就一直重複做{...} */ ans=sqrt(onevar); /*其實sqrt的參數也應該為double 型別*/ printf( SQRT(%f)=%f\n, onevar, ans); printf(X=? ); scanf(%f, onevar); } /* while(onevar */ return 0; } 自己寫 求 x 的平方根的函數 p4.c – 練習 想 Algorithm(1/2) /* This program can find square root of any number that =0 and will stop when you enter a value that 0 */ /* This version is trying to show you that we can write our function/procedure to solve the problem, though the mysqrt() is actually calling the system standard function. We will rewrite the mysqrt() in next version. *****************************/ void hello(void); /*我會用到一個沒參數的函數叫hello() */ double mysqrt(double); /*也會叫用一個叫mysqrt()的函數,參數是一個double數 */ #include math.h /* sqrt()是在math.h內宣告的 */ int main() /* 主程式開始囉 */ { float x; hello(); /* give the user some messa
您可能关注的文档
最近下载
- 浙教版五年级上册信息技术第11课 问题的抽象(课件).pptx VIP
- 2024年中考作文十二大高频热点主题6——阅读真好(素材).pdf VIP
- 飞机在机库溢油应急处置程序.doc
- 2024年中考作文十二大高频热点主题5——挫折成长.docx VIP
- 2024年中考作文十二大高频热点主题4——青春梦想.docx VIP
- 老年人运动能力下降多学科决策模式中国专家共识(2024版)解读PPT课件.pptx VIP
- 2024年绍兴诸暨市水务集团有限公司招聘笔试真题.docx VIP
- Q_320411BFS001-2019TF型扁布袋除尘器系统.pdf
- 【阅读版】读后续写 第1-5期:读懂原文+情节设计.pdf VIP
- 土石方现场协调会会议纪要.pdf VIP
原创力文档


文档评论(0)