移动的小车

#include"graphics.h"#include"math.h"#define PI 3.14void main(){ int x1=50,y1=60,x2=120,y2=100,a=0; void *buf; int size,i,n=1; int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode," "); setbkcolor(BLUE); setcolor(YELLOW); rectangle(x1,y1,x2,y2); circle(x1+10,y2+5...

c编的计算器

#include "stdio.h" /* 标准输入输出库 */#include "string.h" /* 字符串操作函数库 */#include "math.h" /* 数学函数库 */#include "stdlib.h" /* 标准函数库 */#include "graphics.h" /* 图形函数库 */#include "bios.h" /* 基本输入输出系统函数库*/#include "dos.h" /* dos函数库 */#define NU...

for循环题目

输出内容:*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ #include "stdio.h"main(){ int i,j;for(i=0;i<5;i++){ for(j=5;j>i;j--) printf("*+"); printf("\n");}getch();}
WO | 2009-07-10 06:55 | 阅读 2651 次 | 评论 0 条

在口袋中放有手感相同的3只红球、4只白球。随机地从口袋中摸出3只球来,然后放回口

#include<stdio.h>#include<time.h>main(){int h,b,k,i;h=0;b=0;for (i=0;i<500;i++){ k=rand()%7+1; if(k<=3) h++; else b++; } printf("hongqiuyou%d\n",h); printf("baiqiuyou%d\n",b); getch();}
WO | 2009-07-10 06:55 | 阅读 2541 次 | 评论 0 条

// 模拟摸球 500 回,每回 3 次,摸到 1、3、5、7 为白球, 2、4、6、8 为红球

// 模拟摸球 500 回,每回 3 次,摸到 1、3、5、7 为白球, 2、4、6、8 为红球#include<stdio.h>#include<time.h>#define N 500.0int main(void){ int ball[3]; int ball_white; int ball_red; int i; ball_white=ball_red=0; srand(time(NULL)); for(i=0;i<500;++i) { int j; int k; for(j=0;j...

c 用递归写一个10进制换2进制的程序

#include "stdio.h"int xxx(int b){int x=b%2,y=b/2;if(b!=0){ x=x+xxx(y)*10; return x;}}main(){int a,c;scanf("%d",&amp;c);a=xxx(c);printf("%d",a);getch();}
WO | 2009-07-10 06:52 | 阅读 2528 次 | 评论 0 条

c 用递归写一个2进制换十进制的程序

#include<stdio.h>#include<string.h>#define N 33long two_ten( const char * ,int);long num;int main(void){ char str[N]; long ten; while(1) { num=0; fgets(str,N,stdin); if(str[0]=='0') { printf("ten=0\n"); break; } s...

DMS
浏览21918次
文章归档