#include
#include
#include
#include
#include
#include
#include
#include
#include
//”a?aeii, i? ®??aao §¬ia aaaa¬a
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 (“?aaa®c a®!®a § ?aaaa “”a®Fa ¬ac i a «F®a?a¬ici ¬®c?””.\n‚??® c: aaa¤Ya ?“’-11\n’??‘ .I.\nI‚… 2002″);
delay (4000);
//?®«®cY ¬Yi
menu:
clrscr();
printf (“1. ESC=c?ai¤ \n2. ENTER=?a®¤®c¦?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 cc®¤a
start:
clrscr ();
printf (“1.ESC=?®cYaaa?ai c ®a®cY ¬Yi”);
printf (“\n2.ENTER=?a®¤®c¦?a?\n”);
kodkey=getch ();
if (kodkey==27) goto menu;
//‚ci¤ § cYi L,C,R
if (kodkey==13)
{float l,c,r,u,k;
printf (“‚cY¤iai § cYi o¬®aai:\nC=”);
scanf (“%f”,&c);
printf (“‚cY¤iai § cYi i¤a?a?c®aai:\nL=”);
scanf (“%f”,&l);
printf (“‚cY¤iai § cYi ®?®aa:\nR=”);
scanf (“%f”,&r);
printf (“‚cY¤iai § cYi ?®c a?®c®o ?aaF?:\nU=”);
scanf (“%f”,&u);
printf (“‚cY¤iai ¬ aea !:”);
scanf (“%f”,&k);
//‚?!ia c?¤a Faaei? : I(t) !® U(t)
m:
printf (“\n??a § «Y¦iaai !a¤ac a?: I(t) c? U(t)?”);
printf (“\n a?aiai ci¤?®c¤a ?« 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,” ?a aei? I(t)”);
if (kodkey==117) fprintf (fp,” ?a aei? U(t)”);
fclose (fp);}
//Iiaei «i§ aeii Fa aeic®F® aY¦?¬a
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, “c:\\bcpp\\bgi”);
//®!a¤®c ciai ?®®a¤? a i aia??
setcolor(6);
int dx;
for (dx=0; dx
Нашли опечатку? Выделите и нажмите CTRL+Enter