UkrReferat.com

: 75883
: 2016-12-30
7 0



$

'

 

:   

, , :

( )
,
Word Doc
1159
243

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

//a?aeii, i? ??aao ia aaaaa

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;}

//a?aeii, i? ??aao ia ?aaF?

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?a?

clrscr();

printf ("?aaac a!a ?aaaa ""aFaaci a Fa?aici c?"".\n??c: aaaYa ?-11\n?? .I.\nI 2002");

delay (4000);

//?cY Yi

menu:

clrscr();

printf ("1. ESC=c?ai \n2. ENTER=?ac?a?\n");

kodkey=getch();

if (kodkey==27) goto end;

if (kodkey==13) goto start;

else {printf ("?????: Ycia a?aaa ?cie.");

sound (1000);

delay (500);

nosound ();

delay (700);

goto menu;}

//?Yi cca

start:

clrscr ();

printf ("1.ESC=?cYaaa?ai c acY Yi");

printf ("\n2.ENTER=?ac?a?\n");

kodkey=getch ();

if (kodkey==27) goto menu;

//ci cYi L,C,R

if (kodkey==13)

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

printf ("cYiai cYi oaai:\nC=");

scanf ("%f",&c);

printf ("cYiai cYi ia?a?caai:\nL=");

scanf ("%f",&l);

printf ("cYiai cYi ?aa:\nR=");

scanf ("%f",&r);

printf ("cYiai cYi ?ca?co ?aaF?:\nU=");

scanf ("%f",&u);

printf ("cYiai aea!:");

scanf ("%f",&k);

//?!ia c?a Faaei?: I(t) ! U(t)

m:

printf ("\n??a Yiaai !aaca?: I(t) c? U(t)?");

printf ("\na?aiai ci?ca ?ciea: I(t)=i; U(t)=u\n");

kodkey=getch();

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

{printf ("?????: Ycia a?aaa ?cie.");

sound (1000);

delay (500);

nosound ();

delay (700);

goto m;}

//??a cYi c ae

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, ?aea!=%f,",ctime(&t),c,l,r,u,k);

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

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

fclose (fp);}

//Iiaeiiaeii FaaeicF aY?a

int gdriver = DETECT, gmode;

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

//!ac ciai ?a?a i aia??

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");

//!ac Faaei?

{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]

ò