UkrReferat.com

: 75850
: 2016-12-08
7 17



$

'

 

:   

, , :

( )
,
Word Doc
1123
227

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

//i, 猪 i

float I (float c, float l, float r,float t,float u)

{float wo,w2,b,i,e=M_E;

b=r/2*l;

wo=sqrt(1/l*c);

w2=sqrt(fabs(wo-b*b));

i=-u*wo*c*wo*pow(e,-b*t)*sin(w2*t-M_PI)/w2;

return i;}

//i, 猪 i 㣨

float U (float c, float l, float r,float t,float u)

{float w2,wo,b,uf,e=M_E;

b=r/2*l;

wo=sqrt(1/l*c);

w2=sqrt(fabs(wo-b*b));

uf=u-pow(e,-b*t)*u*(w2*cos(w2*t)+sin(w2*t))/w2;

return uf;}

main()

{int kodkey;

//i⪠

clrscr();

printf ("ᮢ ஡ ""ணࠬ㢠 ii "".\n: 㤥 -11\n .I.\nI 2002");

delay (4000);

//

menu:

clrscr();

printf ("1. ESC=i \n2. ENTER=த\n");

kodkey=getch();

if (kodkey==27) goto end;

if (kodkey==13) goto start;

else {printf (": i i.");

sound (1000);

delay (500);

nosound ();

delay (700);

goto menu;}

//

start:

clrscr ();

printf ("1.ESC= ᮢ ");

printf ("\n2.ENTER=த\n");

kodkey=getch ();

if (kodkey==27) goto menu;

//i L,C,R

if (kodkey==13)

{float l,c,r,u,k;

printf ("i i:\nC=");

scanf ("%f",&c);

printf ("i i⨢i:\nL=");

scanf ("%f",&l);

printf ("i :\nR=");

scanf ("%f",&r);

printf ("i ⪮ 㣨:\nU=");

scanf ("%f",&u);

printf ("i ⠡:");

scanf ("%f",&k);

//i i: I(t) U(t)

m:

printf ("\n i 㢠: I(t) U(t)?");

printf ("\ni i i: I(t)=i; U(t)=u\n");

kodkey=getch();

if (kodkey!=105 && kodkey!=117)

{printf (": i i.");

sound (1000);

delay (500);

nosound ();

delay (700);

goto m;}

// 䠩

FILE*fp;

if((fp=fopen("history.dat","a"))==NULL)

{perror("history.dat");

return 1;}

{time_t t;

time(&t);

fprintf(fp,"\n\n%sC=%f, L=%f, R=%f, U=%f, ⠡=%f,",ctime(&t),c,l,r,u,k);

if (kodkey==105) fprintf (fp," i I(t)");

if (kodkey==117) fprintf (fp," i U(t)");

fclose (fp);}

//Iiiii i箣 ०

int gdriver = DETECT, gmode;

initgraph(&gdriver, &gmode, "c:\\bcpp\\bgi");

//㤮 i न i i⪨

setcolor(6);

int dx;

for (dx=0; dx<=640; dx+=10)

{line (0,dx,640,dx);

line (dx,640,dx,0);}

setcolor(10);

rectangle(0,0,639,479);

line(0,240,640,240);

line(20,0,20,640);

setcolor (15);

outtextxy (10,250,"O");

if (kodkey==105) outtextxy (10,10,"I");

if (kodkey==117) outtextxy (10,10,"U");

outtextxy (620,250,"t");

//㤮 i

{float t,i,uf;

moveto(20,240);

if (kodkey==105)

{for (t=0; k*t*10<=600; t+=0.0009)

{i=-I(c,l,r,t,u);

lineto(k*10*t+20,k*10*i+240);}}

if (kodkey==117)

{for (t=0; k*t*10<=600; t+=0.0009)

-----> Page:

0 [1]

ò