|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『楼 主』:
523066680编辑区
@echo off &setlocal enabledelayedexpansion
set /p inp=" : "
call :funa na %inp%
call :funa nb %inp:* =%
set /a lpna=0,lpr=-1
:lpna
set /a lpna+=1,lpnb=0,lpr+=1,lp=lpr
:lpnb
set /a lpnb+=1,lp+=1
::::::::::::::::::::::::::
set /a cup%lp%+=na%lpna%*nb%lpnb%
set /a tlpa=lp,tlpb=tlpa+1
:cuplp
set /a cup%tlpb%+=cup%tlpa%/10,cup%tlpa%=cup%tlpa%%%10
if !cup%tlpb%! gtr 9 (
set /a tlpa+=1,tlpb=tlpa+1
goto :cuplp
) else (if !cup%tlpb%! equ 0 set /a tlpb-=1)
::::::::::::::::::::::::::
if %lpnb% lss %nb% (goto :lpnb)
if %lpna% lss %na% (goto :lpna)
for /l %%a in (%tlpb%,-1,1) do set /p=!cup%%a!<nul
echo,
echo,wscript.echo %inp: =*%>x.vbs
cscript //nologo x.vbs
pause>nul &exit
:funa
set %1=%2
set funaa=0
:funaa
set /a funaa+=1
set %1%funaa%=!%1:~-%funaa%,1!
if not "!%1:~%funaa%!"=="" (goto :funaa)
set /a %1=funaa 版本2
@echo off &setlocal enabledelayedexpansion
set /p inp=" : "
call :naxnb %inp%
pause
:naxnb
set numa=%1
set numb=%2
set /a la=0,lpr=-1
:la
set /a la+=1,lb=0,lpr+=1,lp=lpr
:lb
set /a lb+=1,lp+=1,tlpa=lp,tlpb=lp+1
:::::::::::::::::::::::::
set /a cup%lp%+=!numa:~-%la%,1! * !numb:~-%lb%,1!
:cuplp
set /a cup%tlpb%+=cup%tlpa%/10,cup%tlpa%=cup%tlpa%%%10
if !cup%tlpb%! gtr 9 (
set /a tlpa+=1,tlpb=tlpa+1
goto :cuplp
) else (if !cup%tlpb%! equ 0 set /a tlpb-=1)
::::::::::::::::::::::::::
if not "!numb:~%lb%!"=="" (goto :lb)
if not "!numa:~%la%!"=="" (goto :la)
for /l %%a in (%tlpb%,-1,1) do set /p=!cup%%a!<nul
::::::::vbs验证一下:::::::::::
echo,
echo,wscript.echo %inp: =*%>x.vbs
cscript //nologo x.vbs
pause>nul &exit [ Last edited by 523066680 on 2009-2-21 at 10:46 ]
|
综合型编程论坛
我的作品索引 |
|
2009-2-13 18:49 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
|
2009-2-13 18:50 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
|
2009-2-17 18:15 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
4 楼』:
@echo off &setlocal enabledelayedexpansion
set /p inp=" : "
call :funa na %inp%
call :funa nb %inp:* =%
set /a lpna=0,lpr=-1
:lpna
set /a lpna+=1,lpnb=0,lpr+=1,lp=lpr
:lpnb
set /a lpnb+=1,lp+=1
::::::::::::::::::::::::::
set /a axb=na%lpna%*nb%lpnb%
set /a cup%lp%=axb+cup%lp%
if !cup%lp%! gtr 9 (set "do=") else (set do=::)
%do% set /a tlpa=lp,tlpb=tlpa+1
%do% :cuplp
%do% set /a cup%tlpa%=cup%tlpa%-10,cup%tlpb%+=1
%do% set /a tlpa+=1,tlpb=tlpa+1
%do% if !cup%tlpb%! gtr 9 (goto :cuplp)
::::::::::::::::::::::::::
if %lpnb% lss %nb% (goto :lpnb)
if %lpna% lss %na% (goto :lpna)
for /l %%a in (1,1,8) do echo !cup%%a!
set /a temp=1234*1234
echo %temp%
pause>nul &exit
:funa
set /a %1=%2,funaa=0
:funaa
set /a funaa+=1
set %1%funaa%=!%1:~-%funaa%,1!
if not "!%1:~%funaa%!"=="" (goto :funaa)
set /a %1=funaa
|
综合型编程论坛
我的作品索引 |
|
2009-2-17 18:42 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
5 楼』:
@echo off &setlocal enabledelayedexpansion
title code by 523066680
set /p inp="输入两个乘数 空格隔开: "
call :naxnb %inp%
pause
:naxnb
set numa=%1
set numb=%2
set /a la=0,lb=0,lp=0
:la
set /a la+=1,lb+=1,lp+=1
set /a lb+=1,tlpa=lp,tlpb=lp+1
:::::::::::::::::::::::::
set /a cup%lp%+=!numa:~-%la%,1! + !numb:~-%lb%,1!
:cuplp
set /a cup%tlpb%+=cup%tlpa%/10,cup%tlpa%=cup%tlpa%%%10
if !cup%tlpb%! gtr 9 (
set /a tlpa+=1,tlpb=tlpa+1
goto :cuplp
) else (if !cup%tlpb%! equ 0 set /a tlpb-=1)
::::::::::::::::::::::::::
if not "!numb:~%lb%!"=="" (goto :la)
if not "!numa:~%la%!"=="" (goto :la)
for /l %%a in (%tlpb%,-1,1) do set /p=!cup%%a!<nul
::::::::vbs验证一下:::::::::::
echo,
echo,wscript.echo %inp: =+%>x.vbs
cscript //nologo x.vbs
pause>nul &exit
[ Last edited by 523066680 on 2009-2-21 at 11:29 ]
|
综合型编程论坛
我的作品索引 |
|
2009-2-20 18:49 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
6 楼』:
@echo off&setlocal enabledelayedexpansion
set /a sa=63456,sb=61426
:a
echo, %sb:~1,1%
echo,%sa:~1,3%
echo, %sb:~3,1%
echo,
echo, %sb:~0,1%
echo,&echo,
set /p inp="(w a s d): "
echo,
if %inp% equ w (
set sb=%sb:~1%%sb:~1,1%
)
if %inp% equ s (
set sb=%sb:~3,1%%sb:~0,4%
)
if %inp% equ a (
set sa=%sa:~1%%sa:~1,1%
)
if %inp% equ d (
set sa=%sa:~3,1%%sa:~0,4%
)
goto :a
|
综合型编程论坛
我的作品索引 |
|
2009-3-7 06:27 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
7 楼』:
typedef struct
{
int fa,fb;
} fraction;
char axb[3];
fraction arr[4];
fraction outvar;
int whox[3];
int overa;
void arrangement(int a[],int n);
void next(fraction a[],int n);
void count(fraction a,int x,fraction b,int n);
main()
{
int i,ma[4];
for (i=0;i<4;i++) arr[i].fb=1;
while (1)
{
printf("______________________\nPress [Ctrl+C] = Quit \n\n");
printf("Input 4 numbers,such as: 3 3 8 8 : ");
scanf("%d %d %d %d",&ma[0],&ma[1],&ma[2],&ma[3]);
overa=0;
arrangement(ma,4);
if (overa==0) printf("\n Not result!\n\n");
}
getch();
}
void arrangement(int a[],int n)
{
int temp[4];
int i,j,k;
if (n==0)
{
next(arr,4);
return;
}
for (i=0;i<n;i++)
{ k=0;
arr[4-n].fa=a[i];
for (j=0;j<n;j++) {if (i!=j) temp[k++]=a[j];}
arrangement(temp,n-1);
}
}
void next(fraction a[],int n)
{
int i,j;
fraction temp[4];
if ((overa==0)&&(n==1)&&(a[0].fa==24*a[0].fb))
{printf("\n ");
if (whox[1]==0)
{
if (whox[0]==0)
{printf("[(%d %c %d) %c %d] %c %d",arr[0].fa,axb[0],arr[1].fa,axb[1],arr[2].fa,axb[2],arr[3].fa);}
else if (whox[0]==1)
{printf("[%d %c (%d %c %d)] %c %d",arr[0].fa,axb[1],arr[1].fa,axb[0],arr[2].fa,axb[2],arr[3].fa);}
else if (whox[0]==2)
{printf("(%d %c %d) %c (%d %c %d)",arr[0].fa,axb[1],arr[1].fa,axb[2],arr[2].fa,axb[0],arr[3].fa);}
}
else
{
if (whox[0]==0)
{printf("(%d %c %d) %c (%d %c %d)",arr[0].fa,axb[0],arr[1].fa,axb[2],arr[2].fa,axb[1],arr[3].fa);}
else if (whox[0]==1)
{printf("%d %c [(%d %c %d) %c %d]",arr[0].fa,axb[2],arr[1].fa,axb[0],arr[2].fa,axb[1],arr[3].fa);}
else if (whox[0]==2)
{printf("%d %c [%d %c (%d %c %d)]",arr[0].fa,axb[2],arr[1].fa,axb[1],arr[2].fa,axb[0],arr[3].fa);}
}
printf(" = 24 \n\n");
overa=1;
return;
}
for (i=0;i<n-1;i++)
{
whox[4-n]=i;
for (j=0;j<n;j++){temp[j].fa=a[j].fa;temp[j].fb=a[j].fb;}
for (j=i+1;j<n-1;j++){temp[j].fa=temp[j+1].fa;temp[j].fb=a[j+1].fb;}
for (j=0;j<4;j++)
{
count(a[i],j,a[i+1],n);
temp[i].fa=outvar.fa;
temp[i].fb=outvar.fb;
if (outvar.fb!=0) next(temp,n-1);
}
}
}
void count(fraction a,int x,fraction b,int n)
{
if (x==0)
{
axb[4-n]='+';
outvar.fa=(a.fa*b.fb)+(b.fa*a.fb);
outvar.fb=a.fb*b.fb;
}
else if (x==1)
{
axb[4-n]='-';
outvar.fa=(a.fa*b.fb)-(b.fa*a.fb);
outvar.fb=a.fb*b.fb;
}
else if (x==2)
{
axb[4-n]='*';
outvar.fa=a.fa*b.fa;
outvar.fb=a.fb*b.fb;
}
else if (x==3)
{
axb[4-n]='/';
outvar.fa=a.fa*b.fb;
outvar.fb=a.fb*b.fa;
}
}
附件
1: COUNT24B.rar (2009-6-3 05:26, 7.78 K, 下载附件所需积分 1 点
,下载次数: 1)
|
综合型编程论坛
我的作品索引 |
|
2009-6-3 05:24 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
8 楼』:
二维管道
#include "Conio.h"
#include "graphics.h"
#include "stdlib.h"
#define closegr closegraph
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0;
registerbgidriver(EGAVGA_driver);
initgraph(&gd, &gm, "");
}
int main(void)
{
int a,b,x,y,i,j;
randomize();
initgr(); /* BGI初始化 */
x=y=200;
for (i=1;i<=15;i++)
{
a=rand()%600+1;b=rand()%400+20;
putpixel(x,y,4);
while (x!=a||y!=b)
{
if (x<a)
x++;
else if (x>a)
x--;
else
{
if (y<b)
y++;
else if (y>b)
y--;
}
for (j=0;j<=100;j++) delay(10);
putpixel(x,y,i);
}
}
rectangle(x-5,y-5,x+5,y+5);
getch();
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
}
|
综合型编程论坛
我的作品索引 |
|
2009-7-7 23:33 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
9 楼』:
随机游蛇
#include "Conio.h"
#include "graphics.h"
#include "stdlib.h"
#define closegr closegraph
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0;
registerbgidriver(EGAVGA_driver);
initgraph(&gd, &gm, "");
}
int main(void)
{
int a,b,x,y,i,j,dtl=50,dtn=0;
int dot[50][2];
randomize();
initgr(); /* BGI初始化 */
x=y=200;
dot[dtn][0]=dot[dtn][1]=200;
for (i=1;i<dtl;i++) {dot[i][0]=0;dot[i][1]=0;}
for (i=1;i<=15;i++)
{
a=rand()%600+1;b=rand()%400+20;
putpixel(x,y,4);
while (x!=a||y!=b)
{
if (x<a)
x++;
else if (x>a)
x--;
else
{
if (y<b)
y++;
else if (y>b)
y--;
}
for (j=0;j<=100;j++) delay(10);
putpixel(x,y,i);
if (dtn<(dtl-1)) dtn++;
else dtn=0;
if (dot[dtn][0]!=0) putpixel(dot[dtn][0],dot[dtn][1],0);
dot[dtn][0]=x;dot[dtn][1]=y;
}
}
rectangle(x-5,y-5,x+5,y+5);
getch();
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
}
|
综合型编程论坛
我的作品索引 |
|
2009-7-7 23:57 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
10 楼』:
多条随机游动的snake
#include <Conio.h>
#include <graphics.h>
#include <stdlib.h>
#define closegr closegraph
#define NSNK 5
#define LONG 60
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0;
registerbgidriver(EGAVGA_driver);
initgraph(&gd, &gm, "");
}
int main(void)
{
int i,j;
struct {
int a,b,x,y,dtl,dtn,dot[LONG][2];
} snk[NSNK];
initgr(); /* BGI初始化 */
for (i=0;i<NSNK;i++) {
snk[i].a=snk[i].b=snk[i].x=snk[i].y=snk[i].dot[0][0]=snk[i].dot[0][1]=200;
snk[i].dtl=LONG;
snk[i].dtn=0;
for (j=1;j<LONG;j++) {snk[i].dot[j][0]=snk[i].dot[j][1]=0;}
}
randomize();
while (!kbhit())
{
for (i=0;i<150;i++) delay(10);
for (i=0;i<NSNK;i++){
putpixel(snk[i].x,snk[i].y,i+1);
if ((snk[i].x==snk[i].a)&&(snk[i].y==snk[i].b)){
snk[i].a=rand()%600+1;
snk[i].b=rand()%400+20;
}
}
for (i=0;i<NSNK;i++){
if (snk[i].x>snk[i].a)
snk[i].x--;
else if (snk[i].x<snk[i].a)
snk[i].x++;
else
{
if (snk[i].y>snk[i].b)
snk[i].y--;
else if (snk[i].y<snk[i].b)
snk[i].y++;
}
if (snk[i].dtn<(snk[i].dtl-1)) snk[i].dtn++;
else snk[i].dtn=0;
if (snk[i].dot[snk[i].dtn][0]!=0) putpixel(snk[i].dot[snk[i].dtn][0],snk[i].dot[snk[i].dtn][1],0);
snk[i].dot[snk[i].dtn][0]=snk[i].x;
snk[i].dot[snk[i].dtn][1]=snk[i].y;
}
}
getch();
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
} NLine
#include <Conio.h>
#include <graphics.h>
#include <stdlib.h>
#define closegr closegraph
#define NSNK 5
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0;
registerbgidriver(EGAVGA_driver);
initgraph(&gd, &gm, "");
}
int main(void)
{
int i,j;
struct {
int a,b,x,y;
} snk[NSNK];
initgr(); /* BGI初始化 */
for (i=0;i<NSNK;i++) {
snk[i].a=snk[i].b=snk[i].x=snk[i].y=200;
}
randomize();
while (!kbhit())
{
for (i=0;i<150;i++) delay(10);
for (i=0;i<NSNK;i++){
putpixel(snk[i].x,snk[i].y,i+1);
if ((snk[i].x==snk[i].a)&&(snk[i].y==snk[i].b)){
snk[i].a=rand()%600+1;
snk[i].b=rand()%400+20;
}
}
for (i=0;i<NSNK;i++){
if (snk[i].x>snk[i].a)
snk[i].x--;
else if (snk[i].x<snk[i].a)
snk[i].x++;
else
{
if (snk[i].y>snk[i].b)
snk[i].y--;
else if (snk[i].y<snk[i].b)
snk[i].y++;
}
}
}
getch();
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
} 5RandDot
#include <Conio.h>
#include <graphics.h>
#include <stdlib.h>
#define closegr closegraph
#define NDOT 5
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0;
registerbgidriver(EGAVGA_driver);
initgraph(&gd, &gm, "");
}
void func(int x,int y,int c)
{
putpixel(x,y,c);
putpixel(x+1,y,c);
putpixel(x,y+1,c);
putpixel(x+1,y+1,c);
}
int main(void)
{
int i,j,whi=0;
struct {
int a,b,x,y,tx,ty;
} snk[NDOT];
initgr(); /* BGI初始化 */
for (i=0;i<NDOT;i++) {
snk[i].a=snk[i].b=snk[i].x=snk[i].y=200;
}
randomize();
while (!kbhit())
{
if (whi<4) whi++; else whi=0;
for (i=0;i<150;i++) delay(10);
for (i=0;i<NDOT;i++){
func(snk[i].tx,snk[i].ty,0);
func(snk[i].x,snk[i].y,i+1);
if ((snk[i].x==snk[i].a)&&(snk[i].y==snk[i].b)){
snk[i].a=rand()%600+1;
snk[i].b=rand()%400+20;
}
}
for (i=0;i<NDOT;i++){
snk[i].tx=snk[i].x;
snk[i].ty=snk[i].y;
if (whi>i) continue;
if (snk[i].x>snk[i].a)
snk[i].x--;
else if (snk[i].x<snk[i].a)
snk[i].x++;
else
{
if (snk[i].y>snk[i].b)
snk[i].y--;
else if (snk[i].y<snk[i].b)
snk[i].y++;
}
}
}
getch();
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
} [ Last edited by 523066680 on 2009-7-13 at 22:18 ]
|
综合型编程论坛
我的作品索引 |
|
2009-7-13 00:07 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
11 楼』:
变幻的三角形
#include <Conio.h>
#include <graphics.h>
#include <stdlib.h>
#define closegr closegraph
#define NDOT 3
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0;
registerbgidriver(EGAVGA_driver);
initgraph(&gd, &gm, "");
}
void delta(int xa,int ya,int xb,int yb,int xc,int yc,int c)
{
setcolor(c);
line(xa,ya,xb,yb);
line(xa,ya,xc,yc);
line(xb,yb,xc,yc);
}
int main(void)
{
int i,j,whi=0;
struct {
int a,b,x,y,tx,ty;
} snk[NDOT];
initgr(); /* BGI初始化 */
for (i=0;i<NDOT;i++) {
snk[i].a=snk[i].b=snk[i].x=snk[i].y=200;
}
randomize();
while (!kbhit())
{
if (whi<3) whi++; else whi=0;
for (i=0;i<200;i++) delay(10);
delta(snk[0].tx,snk[0].ty,snk[1].tx,snk[1].ty,snk[2].tx,snk[2].ty,0);
delta(snk[0].x,snk[0].y,snk[1].x,snk[1].y,snk[2].x,snk[2].y,2);
for (i=0;i<NDOT;i++){
if ((snk[i].x==snk[i].a)&&(snk[i].y==snk[i].b)){
snk[i].a=rand()%600+1;
snk[i].b=rand()%400+20;
}
}
for (i=0;i<NDOT;i++){
snk[i].tx=snk[i].x;
snk[i].ty=snk[i].y;
if (whi>i) continue;
if (snk[i].x>snk[i].a)
snk[i].x--;
else if (snk[i].x<snk[i].a)
snk[i].x++;
else
{
if (snk[i].y>snk[i].b)
snk[i].y--;
else if (snk[i].y<snk[i].b)
snk[i].y++;
}
}
}
getch();
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
}
|
综合型编程论坛
我的作品索引 |
|
2009-7-13 22:31 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
12 楼』:
变幻的四面体
#include <Conio.h>
#include <graphics.h>
#include <stdlib.h>
#define closegr closegraph
#define NDOT 4
typedef struct
{
int a,b,x,y;
} DotInf;
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0;
registerbgidriver(EGAVGA_driver);
initgraph(&gd, &gm, "");
}
void delta(DotInf dot[],int c)
{
int i,j;
setcolor(c);
for (i=0;i<NDOT;i++)
for (j=i+1;j<NDOT;j++) line(dot[i].x,dot[i].y,dot[j].x,dot[j].y);
}
int main(void)
{
int i,j,whi=0;
DotInf snk[NDOT],everdot[NDOT];
initgr(); /* BGI初始化 */
for (i=0;i<NDOT;i++) {
snk[i].a=snk[i].b=snk[i].x=snk[i].y=200;
}
delta(snk,2);
randomize();
while (!kbhit())
{
if (whi<4) whi++; else whi=0;
for (i=0;i<600;i++) delay(10);
delta(everdot,0);
delta(snk,2);
for (i=0;i<NDOT;i++){
if ((snk[i].x==snk[i].a)&&(snk[i].y==snk[i].b)){
snk[i].a=rand()%600+1;
snk[i].b=rand()%400+20;
}
}
for (i=0;i<NDOT;i++){
everdot[i].x=snk[i].x;
everdot[i].y=snk[i].y;
if (whi>i) continue;
if (snk[i].x>snk[i].a)
snk[i].x--;
else if (snk[i].x<snk[i].a)
snk[i].x++;
else
{
if (snk[i].y>snk[i].b)
snk[i].y--;
else if (snk[i].y<snk[i].b)
snk[i].y++;
}
}
}
getch();
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
} [ Last edited by 523066680 on 2009-8-23 at 07:13 ]
|
综合型编程论坛
我的作品索引 |
|
2009-7-13 23:07 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
13 楼』:
密密麻麻的虫子……
#include <Conio.h>
#include <graphics.h>
#include <stdlib.h>
#define closegr closegraph
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0;
registerbgidriver(EGAVGA_driver);
initgraph(&gd, &gm, "");
}
int main(void)
{
int i,j;
initgr(); /* BGI初始化 */
randomize();
while (!kbhit())
{
for (j=200;j<=300;j++)
{
putpixel(rand()%400+1,j,4);
putpixel(rand()%400+1,j,0);
}
for (j=0;j<200;j++) delay(10);
}
getch();
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
} 狂轰滥炸的感觉~ 乱弄出来的
#include <Conio.h>
#include <graphics.h>
#include <stdlib.h>
#define closegr closegraph
void initgr(void) /* BGI初始化 */
{
int gd = DETECT, gm = 0;
registerbgidriver(EGAVGA_driver);
initgraph(&gd, &gm, "");
}
void func(int x,int y,int c)
{ setcolor(c);
rectangle(x-4,y-4,x+4,y+4);
}
int main(void)
{
int i,j;
initgr(); /* BGI初始化 */
randomize();
while (!kbhit())
{
for (i=1;i<=30;i++)
{
for (j=1;j<=30;j++) if (rand()%30>20) func(j*10,i*10,1);
for (j=1;j<=30;j++) if (rand()%30>10) func(j*5,i*5,0);
}
for (j=0;j<500;j++) delay(20);
}
getch();
closegr(); /* 恢复TEXT屏幕模式 */
return 0;
} [ Last edited by 523066680 on 2009-7-14 at 03:26 ]
|
综合型编程论坛
我的作品索引 |
|
2009-7-14 03:06 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
14 楼』:
[ Last edited by 523066680 on 2009-8-2 at 10:09 ]
|
综合型编程论坛
我的作品索引 |
|
2009-8-2 10:06 |
|
|
523066680
银牌会员
SuperCleaner
积分 2362
发帖 1133
注册 2008-2-2
状态 离线
|
『第
15 楼』:
看来不合格的文本操作代码,我自个儿先留着。 处理的文本为text.txt
过80字节转一行,字符处理可以,效率不好。
@echo off
err>result.x 2>nul
set /a x=0
for /f "delims= eol=#" %%a in (text.txt) do (
set /a x+=1
set /a seta=0,setb=80
echo, %%a>x.x
call :func
)
start result.x
pause
exit
:func
echo,Sentence%x%
type x.x>temp.x
fsutil file setzerodata offset=0 length=%seta% temp.x >nul
fsutil file setzerodata offset=%setb% length=10000 temp.x >nul
(for /f "delims= eol=#" %%c in ('more temp.x') do (echo,%%c>temp.x))||goto :eof
for /f "tokens=3" %%a in ('dir temp.x /-c ^|find "个文件"') do (set num=%%a)
set /a seta=seta+num-2,setb=seta+80 &type temp.x>>result.x &goto :func
goto :eof [ Last edited by 523066680 on 2009-8-18 at 09:41 ]
|
综合型编程论坛
我的作品索引 |
|
2009-8-18 09:39 |
|
|