云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > C语言程序设计100个简单的经典例子

C语言程序设计100个简单的经典例子

  • 62 次阅读
  • 3 次下载
  • 2025/6/14 19:25:51

.

{ do {

scanf(\ }while(a<1||a>50); for(i=1;i<=a;i++) printf(\printf(\n++;} getch(); }

==============================================================

【程序89】

题目:某个公司采用公用电话传递数据,数据是四位的整数,在传递过程中是加密的,加密规则如下:

每位数字都加上5,然后用和除以10的余数代替该数字,再将第一位和第四位交换,第二位和第三位交换。 1.程序分析: 2.程序源代码: main()

{int a,i,aa[4],t; scanf(\aa[0]=a; aa[1]=a0/10; aa[2]=a00/100; aa[3]=a/1000; for(i=0;i<=3;i++) {aa[i]+=5; aa[i]%=10; }

for(i=0;i<=3/2;i++) {t=aa[i];

aa[i]=aa[3-i]; aa[3-i]=t; }

for(i=3;i>=0;i--) printf(\}

==============================================================

【程序90】

题目:专升本一题,读结果。 1.程序分析: 2.程序源代码: #include \

.

.

#define m 5 main()

{int a[m]={1,2,3,4,5}; int i,j,t; i=0;j=m-1; while(i{t=*(a+i); *(a+i)=*(a+j); *(a+j)=t; i++;j--; }

for(i=0;iprintf(\}

【程序91】

题目:时间函数举例1 1.程序分析: 2.程序源代码: #include \#include \void main()

{ time_t lt; /*define a longint time varible*/ lt=time(null);/*system time and date*/ printf(ctime(<)); /*english format output*/ printf(asctime(localtime(<)));/*tranfer to tm*/

printf(asctime(gmtime(<))); /*tranfer to greenwich time*/ }

==============================================================

【程序92】

题目:时间函数举例2

1.程序分析: 2.程序源代码: /*calculate time*/ #include \#include \main()

{ time_t start,end; int i;

start=time(null); for(i=0;i<3000;i++)

{ printf(\end=time(null);

printf(\}

===========================================================

.

.

===

【程序93】

题目:时间函数举例3 1.程序分析: 2.程序源代码: /*calculate time*/ #include \#include \main()

{ clock_t start,end; int i;

double var; start=clock();

for(i=0;i<10000;i++)

{ printf(\end=clock();

printf(\}

==============================================================

【程序94】

题目:时间函数举例4,一个猜数游戏,判断一个人反应快慢。(版主初学时编的) 1.程序分析: 2.程序源代码: #include \#include \#include \main() {char c;

clock_t start,end; time_t a,b; double var; int i,guess;

srand(time(null));

printf(\loop:

while((c=getchar())=='y') {

i=rand()0;

printf(\start=clock(); a=time(null);

scanf(\while(guess!=i)

.

.

{if(guess>i)

{printf(\scanf(\else

{printf(\scanf(\}

end=clock(); b=time(null);

printf(\printf(\if(var<15)

printf(\else if(var<25)

printf(\else

printf(\printf(\printf(\}

printf(\if((c=getch())=='y') goto loop; }

==============================================================

【程序95】

题目:家庭财务管理小程序 1.程序分析: 2.程序源代码:

/*money management system*/ #include \#include \main() {

file *fp;

struct date d;

float sum,chm=0.0; int len,i,j=0; int c;

char ch[4]=\pp: clrscr(); sum=0.0;

gotoxy(1,1);printf(\

.

搜索更多关于: C语言程序设计100个简单的经典例子 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

. { do { scanf(\ }while(a50); for(i=1;i<=a;i++) printf(\printf(\n++;} getch(); } ============================================================== 【程序89】 题目:某个公司采用公用电话传递数据,数据是四位的整数,在传递过程中是加密的,加密规则如下: 每位数字都加上5,然后用和除以10的余数代替该数字,再将第一位和第四位交换,第二位和第三位交换。 1.程序分析: 2.程序源代码: main() {int a,i,aa[4],t; sca

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com