当前位置:三九宝宝网 → 宝宝教育 → 教学论文 → 正文

急需一个C语言编译的有趣的程序

更新:03-18 整理:39baobao.com
字体:

[c语言急需一个简单程序的注释和流程图!]只要看这里 while (k>0) { m=((int)k)%10; //m为k的余数,假如k=345,那么k%10=5,即m=5 count[m]++; //count[m]=count[m]+1 k=k/10; //假如k=345,k/10=34 } } 假如你输入的k=3344...+阅读

以前写的一个,测试时可以用2000作为测试数据:

#include

#include

#include

#include

int main( int argc, char *argv[] )

{

int i, j, k, n = 0, temp;

char s[20][81];

printf( "请输入数字雨落下的时间(单位:0.1秒):" );

scanf( "%d", &k );

system( "cls" );

for( i=0; i

{

for( j=0; j<80; j++ )

{

temp = rand()%3;

s[ n%20 ][j] = ( temp )?( '0' + temp - 1 ):32;

s[ n%20 ][80] = '\0';

}

for( j=n; j>=0 & j>n-20; j-- )

printf( "%s", s[ ( j + 20 )%20 ] );

n++;

Sleep( 100 );

system( "cls" );

}

system( "pause" );

return 0;

}

谁有c语言一些运行起来结果很好玩的程序的代码

/*太大了估计你不想要,给你一个扫雷程序,turbo C下才能编译成功 空格:打标记 回车:扫雷 方向键:改变方向 */ #include #include #include void adjust(int*,int*); int a[23][23],c[22][22],mm,nn; int roundmine(int,int); void spread(); main() { int i,j,b[22][22],minenum,mine; int x,y,yy,s; char g,h,z; int*x1; int*y1; time_t t; again:srand((unsigned) time(&t)); textcolor(LIGHTGREEN); for(i=2;i1&i1&j0) a[i][j]=0; else if(s==0) a[i][j]=1; } if(a[i][j]) minenum++; } gotoxy(50,2); puts("dirction"); gotoxy(50,3); puts("SPACE:mark"); gotoxy(50,4); puts("ENTER:dig"); gotoxy(50,8); printf("mine num:%4d",minenum); gotoxy(50,5); printf("ESC:exit"); gotoxy(30,15); puts(" "); gotoxy(30,20); puts(" "); mine=minenum; gotoxy(2,2); x=2;y=2; while(mine) { h=getch(); if(h=='H') gotoxy(x,--y); else if(h=='P') gotoxy(x,++y); else if(h=='K') gotoxy(--x,y); else if(h=='M') gotoxy(++x,y); x1=&x;y1=&y; adjust(x1,y1); if(h==' ') { if(c[wherex()][wherey()]) if(b[wherex()][wherey()]) { textcolor(LIGHTRED); putch(16); mine--; gotoxy(59,8); printf("%4d",mine); gotoxy(x,y); b[wherex()][wherey()]=0; } else { textcolor(LIGHTGREEN); putch(219); mine++; gotoxy(59,8); printf("%4d",mine); gotoxy(x,y); b[wherex()][wherey()]=1; } } if(h=='\015') { mm=wherex();nn=wherey(); c[wherex()][wherey()]=0; if(a[wherex()][wherey()]) { for(i=2;i21) gotoxy(*x-=20,*y); else if(*y21) gotoxy(*x,*y-=20); } int roundmine(int x,int y) { int i,j,r=0; for(i=x-1;i1&x1&y1&x1&y

哪里有c语言编写的有趣程序

觉的这个怎么样啊?/*a finger-guessing game*/#include#includemain() { char ch; char artificial; int random; while(1)/*如果不退出,则永远玩游戏*/ { srand(time(NULL));/*使rand随机而不重复*/ printf("Please input one case you want to put:\n(A/a:stone;B/b:cloth;C/c:forfex;Q/q:quit)\n"); artificial=getch(); if(artificial=='q'||artificial=='Q') exit(0);/*游戏循环出口*/ if(artificial!='A'&artificial!='B'&artificial!='C'&artificial!='a'&artificial!='b'&artificial!='c') continue;/*其他字母全部跳过*/ if(artificial=='A'||artificial=='a') printf("You put out stone.\n"); if(artificial=='B'||artificial=='b') printf("You put out cloth.\n"); if(artificial=='C'||artificial=='c') printf("You put out forfex.\n"); random=rand()%3+1; switch(random) { case 1:/*这是电脑出石头的情况*/ printf("I put out stone.\n"); if(artificial=='A'||artificial=='a') { printf("Ah,We are the same.\n");/*如果一样,继续*/ continue; } if(artificial=='B'||artificial=='b') { printf("Oh,you are perfect!You have won!"); printf("\nDo you want to play again?y/n\n");/*判断是否继续游戏*/ ch=getch(); if(ch=='y') continue; else exit(0); } if(artificial=='C'||artificial=='c') { printf("Ah,ha!I won!"); printf("\nDo you want to play again?y/n\n"); ch=getch(); if(ch=='y') continue; else exit(0); } case 2:/*电脑出布的情况处理*/ printf("I put out cloth.\n"); if(artificial=='B'||artificial=='b') { printf("Ah,We are the same.\n"); continue; } if(artificial=='C'||artificial=='c') { printf("Oh,you are perfect!You have won!"); printf("\nDo you want to play again?y/n\n"); ch=getch(); if(ch=='y') continue; else exit(0); } if(artificial=='A'||artificial=='a') { printf("Ah,ha!I won!"); printf("\nDo you want to play again?y/n\n"); ch=getch(); if(ch=='y') continue; else exit(0); } case 3:/*电脑出剪刀的情况处理*/ printf("I put out forfex.\n"); if(artificial=='C'||artificial=='c') { printf("Ah,We are the same.\n"); continue; } if(artificial=='B'||artificial=='b') { printf("Ah,ha!I won!"); printf("\nDo you want to play again?y/n\n"); ch=getch(); if(ch=='y') continue; else exit(0); } if(artificial=='A'||artificial=='a') { printf("Oh,you are perfect!You have won!"); printf("\nDo you want to play again?y/n\n"); ch=getch(); if(ch=='y') continue; else exit(0); } } } getch(); }

本文地址:https://www.39baobao.com/show/29_48781.html

以上内容来自互联网,请自行判断内容的正确性。若本站收录的信息无意侵犯了贵司版权,请联系我们,我们会及时处理和回复,谢谢.

以下为关联文档:

c语言编译程序是不是系统软件属于系统软件。 1、系统软件是指控制和协调计算机及外部设备,支持应用软件开发和运行的系统。 比如c语言编译器、汇编编译器、Windows、Linux、安卓、ios等软件。 2、应用软...

VC 6 0编译器是如何编译C语言程序的?是一条语句一条语句的翻译 一个编译器包括词法分析、语法分析、语义分析、中间代码的生成、目标代码的生成、代码优化等 其中词法分析的功能是将一个*.c文件读到内存中,然后...

C语言程序编译问题printf和scanf的缺陷 1.非类型安全 函数原型使编译系统对它进行必要的类型检查,免除了许多错误,但对于printf()和scanf(),它却毫无帮助。printf()和scanf()所期望的参数个数与类型...

C语言编译程序中:体操评分程序去掉一个最高分去掉一个最低你好: 希望我写的程序能有帮助。如果有什么问题,我们可以相互研究一下!/*冒泡法排序*/ #include void main() { float a[10],t=0,sum=0,avg=0; int i,j; printf("请输入10位同学...

怎样使用VC软件编译并运行C语言程序大致步骤如下: 1、打开软件,界面为 2、点击File-New,点击后出来对话框 3、选择Files-C++ Source File ,然后在右边的File栏填对应C语言的名称,如test.c,然后选择location可以选...

C语言程序编译...... 你的程序在DEV-C++4.9.9.2里面编译通不过。你加我QQ897357142 #include "stdio.h" void xueya() { int gao=0,di=0; printf("请输入血压高低:"); scanf("%d%d",&gao,&di); if(g...

用c语言编译个程序第三题: #include<stdio.h> void main() { int m, n, m1, n1, t; printf("input n,m:"); scanf("%d,%d", &n, &m); if (n < m) { m1 = m; n1 = n; } else { m1 = n; n1 = m; } do...

C程序编译如何编void main() {int T[8],X=0,Y=0,i; for(i=0;i<8;i++) { scanf("%d",&t[i]); if(t[i]%2==0) X++; else Y++; } if(X>Y) printf("B"); else if(X=Y) printf("C"); else printf("A"); }...

一个有趣的C语言程序求解释a 是格式化字符串, 替换后程序实际打印为: printf( "main() {char*a=%c%s%c;printf(a,34,a,34);}", 34, "main() {char*a=%c%s%c;printf(a,34,a,34);}", 34 ); 34的ASCII是双引号,...