1、第一题:程序改动 page6#include #include #include #include main()int graphdrv=VGA;int graphmode=VGAHI;int a=150,t=0,x,u=20,N=1000,y=200,r=4,i;float w=0.05,f=0.8;initgraph(for (t=0;t#include #include #include main()int graphdrv=DETECT;int graphmode;int a=30,t=0,N=200;int y0638,y10638,y20638,y1638,y2638,y638,i
2、,x;float w=0.2,v=3.64,f=0;initgraph(y100=a*cos(w*(t-1/v)+f)+80;y200=a*cos(w*(t+1/v)+f)+80;y00=y100+y200+300;for(t=0;t#include#includemain()float r0=20,r,Dr,D0,a=0.529,o,x,y,s=11.75,pi=3.141593;int i,drv=0,mode;randomize();initgraph(setcolor(GREEN);circle(319,239,s*r0);setcolor(WHITE); settextstyle(1
3、,0,1);outtextxy(100,10,“H-3s“);setcolor(YELLOW);outtextxy(440,10,“);while(!kbhit()r=r0*random(32767)/32767.0;Dr=4/3/a/a/a*pow(r/81)*(27-18*r/a+2*pow(r/a),2),2)*exp(-2*r/3/a);D0=0.2*random(32767)/32767.0;if(DrD0)o=2.0*pi*random(32767)/32767.0;x=319+s*r*cos(o);y=239-s*r*sin(o);putpixel(x,y,7);getch();
4、closegraph();Page110:#include#define N 20#define M 40main()float uN+1M+1,u2N+1M+1,s=1.0/4.0;int m1=M/4,m2=M*3/5,k=0,i,j,color=0;char *xN+1=“0“,“1“,“2“,“3“,“4“,“5“,“6“,“7“,“8“,“9“,“10“;char c;int drv=0,mode;initgraph(for(i=0;i=0;i-)if(i0;i-)for(j=1;j“);outtextxy(300,460,“);c=getch();if(c=27) exit(0);
5、goto loop;closegraph();第八题:#include #define PI 3.141593main()float u2121,h=0.05;int i=0,j=0;for(i=1;i20;i+)ui0=sin(i*PI*h);ui1=0.5*(sin(i+1)*PI*h)+sin(i-1)*PI*h)+0.05*i*h*(1-i*h);for(j=0;j=20;j+)u0j=0;u20j=0;for(j=1;j20;j+)for(i=1;i20;i+)uij+1=ui+1j+ui-1j-uij-1;for(j=0;j=20;j+)for(i=0;i=20;i+)printf(“%f“,uij);printf(“n“);getch();