program Perhitungan_kompon_pendek_dan_kompon_panjang;
uses crt;
function kompon_pjg(f_ia, f_ra, f_rsr, f_vt, f_vs: real): real;
begin
kompon_pjg := (f_ia*f_ra) + (f_ia*f_rsr) + f_vt + f_vs;
end;
function kompon_pdk(f_ia, f_ra, f_il, f_rsr, f_vt, f_vs: real): real;
begin
kompon_pdk := (f_ia*f_ra) + (f_il*f_rsr) + f_vt + f_vs;
end;
var
Ea,Ia,Ra,Il,Vsh,Vt,Vs,Rsr, pil: real;
begin
clrscr;
writeln('PROGRAM PERHITUNGAN GENERATOR KOMPON');
writeln;
writeln('1. Perhitungan kompon panjang');
writeln('2. Perhitungan kompon pendek');
write('masukan pilihan : ');
readln(pil);
writeln;
if(pil = 1)then
begin
writeln('masukan nilai Ia,Ra,Rsr,Vt,Vs');
writeln('diprogram untuk mencari nilai kompon panjang');
writeln;
write('nilai Ia=');readln(Ia);
write('nilai Ra=');readln(Ra);
write('nilai Rsr=');readln(Rsr);
write('nilai Vt=');readln(Vt);
write('nilai Vs=');readln(Vs);
Ea:=kompon_pjg(Ia, Ra, Rsr, Vt, Vs);
write('Hasil Kompon Panjang (Ea):',Ia:2:2,'*',Ra:2:2,'+',Ia:2:2,'*',Rsr:2:2,'+',Vt:2:2,'+',Vs:2:2,'=',Ea:2:2);
readln;
end
else if (pil = 2)then
begin
writeln('masukan nilai Ia,Ra,Il,Rsr,Vt,Vs');
writeln('di program untuk mencari nilai Kompon Pendek');
writeln;
writeln('nilai Ia :');readln(Ia);
writeln('nilai Ra :');readln(Ra);
Writeln('nilai Il :');readln(Il);
Writeln('nilai Rsr :');readln(Rsr);
writeln('nilai Vt :');readln(Vt);
writeln('nilai Vs :');readln(Vs);
Ea:=kompon_pdk(Ia, Ra, Il, Rsr, Vt, Vs);
writeln('nilai Kompon Pendek (Ea) :',Ia:2:2,'*',Ra:2:2,'+',Il:2:2,'*',Rsr:2:2,'+',Vt:2:2,'+',Vs:2:2,'=',Ea:2:2);
readln;
end
else
begin
writeln('salah input');
end;
readln;
end.
Tidak ada komentar:
Posting Komentar