ja może starej daty programista jestem
Teraz nie mogę przestać wyobrażać sobie Ciebie jako tego gościa z twojego awatara.
c nie jest integer.
Kod: Zaznacz cały
uses crt;
var
a,b,c,e,d,f:comp;
K:char;
liczba:real;
stopien:integer;
licznik, mianownik, licznik2, mianownik2:int64;
a1,b1,c3,x,y:int64;
z,c1,c2:char;
tablica:array[1..8]of string;
procedure noniebardzo;
Begin
Writeln('Chciałbyś... Teraz się przez ciebie zapętle.');
Delay(4000);
Write('No, chyba że chcesz mnie wyłączyć. Jeśli tak, to wciśnij 0, a jak nie to jakąś inną cyfre.');
z:=readkey;
If z='0' then halt;
end;
Procedure silnia;
Begin
Repeat
clrscr;
Write('Wpisz liczbe: ');
Readln(a);
b:=1;
c:=1;
Repeat
b:=b+1;
c:=c*b;
Until b=a;
Write('Wynik: ',c:0:0,' Wpisz 0, żeby wyjść');
K:=readkey;
Until K='0';
end;
procedure mnozenie;
Begin
repeat;
clrscr;
Write('Ile liczb będziesz mnożyć?');
readln(a);
If a<=1 then noniebardzo;
b:=1;
writeln('wpisz 1 liczbę');
read(c);
Repeat
b:=b+1;
writeln('wpisz ',b:0:0,' liczbę');
read(d);
e:=d;
c:=c*e;
until b=a;
writeln('wynik=',c:0:0);
write('A jak chcesz wyjść to wpisz 1.');
K:=readkey;
clrscr;
until K='1';
end;
procedure dodawanie;
Begin
repeat;
clrscr;
Write('Ile liczb będziesz dodawać?');
readln(a);
If a<=1 then noniebardzo;
b:=1;
writeln('wpisz 1 liczbę');
read(c);
Repeat
b:=b+1;
writeln('wpisz ',b:0:0,' liczbę');
read(d);
e:=d;
c:=c+e;
until b=a;
writeln('wynik=',c:0:0);
write('A jak chcesz wyjść to wpisz 1.');
K:=readkey;
clrscr;
until K='1';
end;
procedure odejmowanie;
Begin
repeat;
clrscr;
Write('Ile liczb będziesz odjąć?');
readln(a);
If a<=1 then noniebardzo;
b:=1;
writeln('wpisz 1 liczbę (od tej odejmujesz)');
read(c);
Repeat
b:=b+1;
writeln('wpisz ',b:0:0,' liczbę');
read(d);
e:=d;
c:=c-e;
until b=a;
writeln('wynik=',c:0:0);
write('A jak chcesz wyjść to wpisz 1.');
K:=readkey;
clrscr;
until K='1';
end;
procedure pot1;
Begin
writeln('wynik=1');
readkey;
clrscr;
end;
procedure pot2;
Begin
writeln('wynik=',c:0:0);
readkey;
clrscr;
end;
procedure pot3;
Begin
Repeat
f:=d;
b:=b+1;
e:=c*f;
c:=e;
until b=a;
writeln('wynik=',c:0:0);
end;
procedure potegowanie;
Begin
repeat;
clrscr;
Write('Wpisz wykładnik! ');
readln(a);
b:=1;
write('A tu podstawe! ');
read(c);
d:=c;
If a=0 then pot1;
If a=1 then pot2;
If a>1 then pot3;
write('A jak chcesz wyjść to wpisz 1.');
k:=readkey;
clrscr;
until K='1';
end;
function pierwiastek(liczba:real; stopien:integer):real;
begin
if(liczba>0)and(stopien>0) then
pierwiastek:= Exp((1/stopien)*LN(liczba))
else
pierwiastek:= 0;
end;
procedure pierwiastko;
begin
repeat
clrscr;
write('Podaj stopien pierwiastka: ');
readln(stopien);
write('Podaj liczbe pod pierwiastkiem: ');
readln(liczba);
writeln('Pierwiastek ',stopien,' stopnia z ',liczba:0:2,' wynosi: ',pierwiastek(liczba,stopien):0:0,' a 0 to wyjście!');
K:=readkey;
until K='0';
end;
Procedure NWD;
Begin
while x<>y do
if x>y then
x:=x-y
else
y:=y-x;
end;
Procedure M;
Begin
repeat
clrscr;
ReadLn(licznik);
WriteLn('----');
ReadLn(mianownik);
WriteLn(' ');
ReadLn(licznik2);
WriteLn('----');
ReadLn(mianownik2);
x:=licznik*licznik2;
y:=mianownik*mianownik2;
a1:=x;
b1:=y;
If x<>y then NWD;
Writeln('Wynik:');
Writeln(a1/x:0:0);
Writeln('----');
Writeln(b1/x:0:0);
readkey;
Writeln('0, by wyjść');
z:=readkey;
until z='0';
end;
Procedure Dz;
Begin
repeat
clrscr;
ReadLn(licznik);
WriteLn('----');
ReadLn(mianownik);
WriteLn(' ');
ReadLn(licznik2);
WriteLn('----');
ReadLn(mianownik2);
x:=licznik*mianownik2;
y:=mianownik*licznik2;
a1:=x;
b1:=y;
If x<>y then NWD;
Writeln('Wynik:');
Writeln(a1/x:0:0);
Writeln('----');
Writeln(b1/x:0:0);
readkey;
Writeln('0, by wyjść');
z:=readkey;
until z='0';
end;
Procedure Dod;
Begin
repeat
clrscr;
ReadLn(licznik);
WriteLn('----');
ReadLn(mianownik);
WriteLn(' ');
ReadLn(licznik2);
WriteLn('----');
ReadLn(mianownik2);
x:=(licznik*mianownik2)+(licznik2*mianownik);
y:=mianownik*mianownik2;
a1:=x;
b1:=y;
If x<>y then NWD;
Writeln('Wynik:');
Writeln(a1/x:0:0);
Writeln('----');
Writeln(b1/x:0:0);
readkey;
Writeln('0, by wyjść');
z:=readkey;
until z='0';
end;
Procedure Od;
Begin
repeat
clrscr;
ReadLn(licznik);
WriteLn('----');
ReadLn(mianownik);
WriteLn(' ');
ReadLn(licznik2);
WriteLn('----');
ReadLn(mianownik2);
x:=(licznik*mianownik2)-(licznik2*mianownik);
y:=mianownik*mianownik2;
a1:=x;
b1:=y;
If a1=0 then x:=1;
If a1=0 then x:=1;
If a1=0 then b1:=0;
If a1<>b1 then NWD;
Writeln('Wynik:');
Writeln(a1/x:0:0);
Writeln('----');
Writeln(b1/x:0:0);
readkey;
Writeln('0, by wyjść');
z:=readkey;
until z='0';
end;
procedure ulamki;
Begin
repeat
Tablica[1]:=' Dodawanie ';
Tablica[2]:=' Odejmowanie ';
Tablica[3]:=' Mnożenie ';
Tablica[4]:=' Dzielenie ';
Tablica[5]:=' Wyjście ';
ClrScr;
TextColor(15);
For c3:=1 to 5 do
Begin
TextColor(15);
TextBackGround(0);
GoToXY(32,11+c3);
Write(tablica[c3]);
End;
c3:=1;
Repeat
TextColor(0);
TextBackGround(15);
GotoXY(32,11+c3);
Write(tablica[c3]);
c1:=ReadKey;
c2:=' ';
If c1=Chr(0) Then c2:=ReadKey;
TextColor(15);
TextBackGround(0);
GotoXY(32,11+c3);
Write(tablica[c3]);
If c2='H' Then Dec(c3);
If c2='P' Then Inc(c3);
If c3=0 Then c3:=5;
If c3=6 Then c3:=1;
If c1=Chr(27) Then c3:=5;
Until (c1=chr(27)) or (c1=chr(13));
If c3=1 Then Dod;
If c3=2 Then Od;
If c3=3 Then M;
If c3=4 Then Dz;
Until c3=5;
clrscr;
end;
Begin
repeat
Tablica[1]:=' Mnożenie ';
Tablica[2]:=' Dodawanie ';
Tablica[3]:=' Odejmowanie ';
Tablica[4]:=' Potęgowanie ';
Tablica[5]:=' Pierwiastkowanie ';
Tablica[6]:=' Silnia ';
Tablica[7]:=' Ułamki ';
Tablica[8]:=' Wyjście ';
ClrScr;
TextColor(15);
For c3:=1 to 8 do
Begin
TextColor(15);
TextBackGround(0);
GoToXY(32,11+c3);
Write(tablica[c3]);
End;
c3:=1;
Repeat
TextColor(0);
TextBackGround(15);
GotoXY(32,11+c3);
Write(tablica[c3]);
c1:=ReadKey;
c2:=' ';
If c1=Chr(0) Then c2:=ReadKey;
TextColor(15);
TextBackGround(0);
GotoXY(32,11+c3);
Write(tablica[c3]);
If c2='H' Then Dec(c3);
If c2='P' Then Inc(c3);
If c3=0 Then c3:=8;
If c3=9 Then c3:=1;
If c1=Chr(27) Then c3:=8;
Until (c1=chr(27)) or (c1=chr(13));
If c3=1 then mnozenie;
If c3=2 then dodawanie;
If c3=3 then odejmowanie;
If c3=4 then potegowanie;
If c3=5 then pierwiastko;
If c3=6 then silnia;
If c3=7 then ulamki;
until c3=8;
clrscr;
end.
-- 10 lut 2013, o 20:04 --
Zrobiłem tak, że działa.
Zaisntalowałem Geany pod Wine a ono (Geany) zrobiło taką magie:
Kod: Zaznacz cały
Kalk.pas(145,3) Warning: Automatic type conversion from floating type to COMP which is an integer type
I działa.