十万火急!~跪求该程序详细注解!~

来源:百度知道 编辑:UC知道 时间:2024/05/30 08:59:19
#include<conio.h>
#include<stdio.h>

int check(int x)
{
int i=0;

for(i=2;i<x;i++)
if(x%i==0)break;

if(i==x) return 1;
else return 0;
}

void main()
{
FILE *fp;
int i=0;
int n=0;

fp=fopen("a.txt","w");

printf("请输入n值: ");
scanf("%d",&n);

printf("小于%d的所有素数为: \n",n);
for(i=1;i<=n;i++)
{
if(check(i))
{
printf("%d ",i);
fprintf(fp,"%d\n",i);
}
}

fclose(fp);

getch();
}
是这个编程
上面那个不对
#include "graphics.h"
#include "conio.h"
#include "bios.h"
#include "stdio.h"
#define ESC 0x011b
#define UP 0x4800
#define DOWN 0x5000
#define LEFT 0x4b00
#define RIGHT 0x4d00

main()
{

看得懂 也不看 20分。。。要写也要花20分钟哦。。。
你要编一个球在上面走?为什么不编俄罗斯方块??

#include "graphics.h" 调图形函数库等几个库
#include "conio.h"
#include "bios.h"
#include "stdio.h"
#define ESC 0x011b
#define UP 0x4800 设置上下左右 键是键盘上的哪个键
#define DOWN 0x5000
#define LEFT 0x4b00
#define RIGHT 0x4d00

main()
{
int driver,mode;
float w=200,m=100; 设初始高宽
int key = 0;
printf("Input Number of Butt: "); 没弄清楚你打1行字有什么用?又没输入?

driver=VGA;mode=VGAHI;
initgraph(&driver,&mode,""); 初始图形模式,都是定式没什么理解的
setbkcolor(GREEN); 为什么要绿色的???绿绿的。。。
while (key != ESC) 没按ESC 不停循环,下面是判断按键盘了没有,按什么键,按上球就上,按下球就下。。。。
{ while (bioskey(1) == 0);
key = bioskey(0);
switch (key)
{ case UP:
{cleardevice();
setcolor(8);
circle(m,w,25);}
w--;
break;
case DOWN:
{cleardevice();
setcolor(8);
circle(m,w,