c语言开发入门与项目实战练习(Introduction to C language development and practice of project practice).docVIP

c语言开发入门与项目实战练习(Introduction to C language development and practice of project practice).doc

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
c语言开发入门与项目实战练习(Introduction to C language development and practice of project practice).doc

c语言开发入门与项目实战练习(Introduction to C language development and practice of project practice) 1.输出一个n! # includes stdio.h main () {int i, n; long p; printf (enter n:); scanf (% d, n). for (i = 1, the = n; i + +) p = p *. printf (n! =% ld \ n , p); } 2.熟悉几个循环的语句 while (! x) x + +; 当 x = 0 时, 执行循环体x + +; while ((c = getchar ()). = \ n) n = n + 1; no 称为计数器, 作用是统计输入字符的个数 while (num + + = 2); printf (% d \ n, n); 循环体是空语句, 退出循环后输出num的值 c x = - 3; while (x 5). 先执行循环体x * = - 3, 再判断条件 (x 5) for n = 0; n 26; n + +) printf (% c, n + a). 作用是输出26个大写字母 for (sum = 0, i = 1, the = 100; sum = sum + 1, i + = 2); 作用是计算100以内的奇数和 3.数值解法计算某点附近的根 # includes stdio.h # includes math.h main () (float x, x0, f, f1. printf (输入的初始根x0 =); scanf (% f, x); x = 1.5; i give {x0 = x; f = 2 * x0 * x0 * x0 + 4 * x0 * x0 - 7 * x0 - 6; f1 = 6 * x0 * x0 + 8 * x0 - 7. x = x0 - f / f1. } while (two years ago (x - x0) 1 - 6). printf (% f \ n, x); } 4.编程序求2~10000以内的完全数 完全数: 一个数的因子 (除了这个数本身) 之和等于该数本身. main () {int i, j, s; for (i = 2; the = 10000; i + +) {s = 0; for (j = 1; j i; j + +) if (i% j = = 0) s + = j; if (i = = d) printf (% 6d \ n, s); } } 5.改写大小写字母 # includes stdio.h main () { char ch; ch = putchar (); if (ch = ch = z) ch = ch + 32. printf (% c \ n, ch); } 6.比较两个数的大小 # includes stdio.h void main () { int x, y; printf (输入两个整数, x和y:); scanf (% d% d x y); if (x y) printf (x y \ n ); else if (x - y) printf (x y \ n ); else printf (x = y \ n ); } 7.猴子吃桃 # includes stdio.h void main () { int i, sum = 1; for (i = 1, the = 9; i + +) { (sum = sum + 1) * 2); } printf (% d, sum); } 8.求100 - 200之间的素数 # includes stdio.h void main () { int i, k, m; for (i = 100; the 200; i + +) for (k = 2; k -; k + +) { if the% k = = 0) break; / / 素数的定义 else { if (i = = k + 1) { printf (% d). m + +; / / 计数 if (m% 5 = = 0) printf (\ n); } } } } 9.for循环随机显示数 # includes stdio.h # includes stdlib.h void main () { int c; for (c = 0 and c 10; c + +) { srand (c + 2). printf (随机发生数% d是:% d \ n, c, rand ())

您可能关注的文档

文档评论(0)

zhangningclb + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档