|
|
|
const Pi=3.1415926535897932384626433832795; | |
a,b,c,d:integer; | |
i:byte; | |
f2:string[6]; | |
f1:char; | |
textcolor(15); | |
textbackground(1); | |
writeln ('1.Reshat kvadratnoe uravnenie'); | |
writeln ('2.Kalkulator'); | |
writeln ('3.Pryamie trigonometricheskie uravneniya'); | |
writeln ('4.Obratnie trigonometricheskie uravneniya'); | |
writeln ('0.Exit'); | |
write ('Vvedite nomer funkcii: '); | |
{KVADRATNOE URAVNENIE} | |
if (i=1) then | |
begin | |
writeln ('Axx+Bx+C=0'); | |
write ('Vvedite koeficient "A": '); | |
readln (a); | |
write ('Vvedite koeficient "B": '); | |
readln (b); | |
write ('Vvedite koeficient "C": '); | |
readln (c); | |
If a=0 then | |
begin | |
x1:=-c/b; | |
write (b,'x'); | |
if c>=0 then write ('+',c,'=0') | |
else write (c,'=0 '); | |
write ('imeet reshenie x=',x1:4:3); | |
end | |
else | |
begin | |
d:=sqr(b)-4*a*c; | |
case d of | |
-32768..-1 : writeln ('D < 0; Resheniy net'); | |
0 : begin | |
x1:=(-b)/(2*a); | |
write (a,'xx'); | |
if b>=0 then write ('+',b,'x') | |
else write (b,'x'); | |
if c>=0 then write ('+',c,'=0') | |
else write (c,'=0 '); | |
writeln (' imeet reshenie x=',x1:4:3); | |
end; | |
1..32767 : begin | |
x1:=(-b+sqrt(d))/(2*a); | |
x2:=(-b-sqrt(d))/(2*a); | |
write (a,'xx'); | |
if b>=0 then write ('+',b,'x') | |
else write (b,'x'); | |
if c>=0 then write ('+',c,'=0') | |
else write (c,'=0 '); | |
writeln (' imeet resheniya x1= ',x1:4:3,', x2= ',x2:4:3); | |
end; | |
end; | |
end; | |
readln | |
end; | |
{Konec kvad. uravneniya} | |
{KALKULATOR} | |
if (i=2) then | |
begin | |
writeln ('-----------------'); | |
writeln ('| 7 | 8 | 9 | * |'); | |
writeln ('|---------------|'); | |
writeln ('| 4 | 5 | 6 | / |'); | |
writeln ('|---------------|'); | |
writeln ('| 1 | 2 | 3 | + |'); | |
writeln ('|---------------|'); | |
writeln ('| 0 | . | = | - |'); | |
writeln ('-----------------'); | |
gotoxy (1,11); | |
write ('Vvedite pervoe chislo: '); | |
readln (a); | |
write ('Vvedite vtoroe chislo: '); | |
readln (b); | |
write ('Vvedite deystvie nad nimi: '); | |
readln (f1); | |
case f1 of | |
'+' : x1:=a+b; | |
'-' : x1:=a-b; | |
'*' : x1:=a*b; | |
'/' : x1:=a/b; | |
else writeln ('Oshibka v deystvii'); | |
end; | |
writeln (a,f1,b,'=',x1:4:3); | |
readln | |
end; {Konec kalkulatora} | |
{PRYAMIE TRIGONOMETRICHESKIE URAVNENIYA} | |
if (i=3) then | |
begin | |
write ('Vvedite trigonometr. funkciyu (sin,tg,cos,ctg): '); | |
readln (f2); | |
write ('ot znacheniya: (ugli- v gradusah!)'); | |
gotoxy (16,2); | |
readln (u); | |
begin | |
x1:=(2*Pi*u)/360; | |
if f2='sin' then begin | |