C语言经典例子100例

loading 分享 2026-11-8 下载文档

============================================================== 【程序34】 题目:练习函数调用 1. 程序分析: 2.程序源代码: #include \#include \void hello_world(void) { printf(\} void three_hellos(void) { int counter; for (counter = 1; counter <= 3; counter++) hello_world();/*调用此函数*/ } void main(void) { three_hellos();/*调用此函数*/ getch(); } ============================================================== 【程序35】 题目:文本颜色设置 1.程序分析: 2.程序源代码: #include \#include \void main(void) { int color; for (color = 1; color < 16; color++) { textcolor(color);/*设置文本颜色*/ cprintf(\ } textcolor(128 + 15); cprintf(\ getch(); } ============================================================== 【程序36】 题目:求100之内的素数 1.程序分析: 2.程序源代码: #include \#include \#define N 101 main() { int i,j,line,a[N]; for(i=2;ia[j]) min=j; tem=a; a=a[min]; a[min]=tem; } /*output data*/ printf(\ for(i=0;iend) a[10]=number; else { for(i=0;i<10;i++) { if(a>number) { temp1=a; a=number; for(j=i+1;j<11;j++) { temp2=a[j]; a[j]=temp1; temp1=temp2; }


C语言经典例子100例.doc 将本文的Word文档下载到电脑
搜索更多关于: C语言经典例子100例 的文档
相关推荐
相关阅读