Script rincian harga & kembalian:
program moddiv_wahyusaptaaji_111221110;
uses WinCrt;
const
ch:array [1..10] of longint=(100,200,500,1000,2000,5000,10000,20000,50000,100000);
var
a,b,c,d,e,f:string;
i,j,x,y,l:shortint;
tpr,cost,pay,cback,cch:longint;
it:array[1..10] of string;
pr:array[1..10] of longint;
qty:array[1..10] of shortint;
begin
repeat
clrscr;
y:=0; i:=0; tpr:=0; cost:=0; l:=47;
gotoxy (2,1); for x:=1 to l do write (#61);
gotoxy (2,3); for x:=1 to l do write (#61);
gotoxy (2,5); for x:=1 to l do write (#61);
gotoxy (56,1); for x:=1 to 21 do write (#61);
gotoxy (56,3); for x:=1 to 21 do write (#61);
gotoxy (56,2); write (' STRUKTUR DATA ');
gotoxy (22,2); write (#83#45#77#65#82#84);
gotoxy (8,4); write (#73#116#101#109);
gotoxy (22,4); write (#80#114#105#99#101);
gotoxy (33,4); write (#81#116#121);
gotoxy (42,4); write (#84#111#116#97#108);
repeat
i:=i+1;
gotoxy (4,5+i); readln (it[i]);
gotoxy (56,2); write (#78#85);
if it[i]<>'' then
begin
gotoxy (22,5+i); readln (pr[i]);
gotoxy (34,5+i); readln (qty[i]);
tpr:=pr[i]*qty[i];
gotoxy (42,5+i); writeln (tpr);
cost:=cost+tpr;
end;
until it[i]='';
gotoxy (58,2); write (#82#32#82);
gotoxy (2,6+i-1); for x:=1 to l do write (#45);
gotoxy (65,2); write (#32#45#32#49#49#49);
gotoxy (4,6+i); write (#84#79#84#65#76);
gotoxy (61,2); write (#65#70);
gotoxy (42,6+i); write (cost);
gotoxy (4,7+i); write (#66#65#89#65#82);
gotoxy (63,2); write (#70#73);
gotoxy (42,7+i); readln (pay);
gotoxy (71,2); write (#50#50#49#49#49#48);
cback:=pay-cost;
gotoxy (4,8+i); write (#75#69#77#66#65#76#73);
gotoxy (42,8+i); write (cback);
gotoxy (2,9+i); for x:=1 to l do write (#45);
a:=#32#85#97#110#103;
b:=#32#75#111#105#110#32#32;
c:=#32#76#101#109#98#97#114;
d:=#32#82#112#46#32;
e:=#32#80#101#114#109#101#110;
if cback>0 then
begin
gotoxy (4,10+i); write (#82#105#110#99#105#97#110#32#58);
for j:=10 downto 0 do
begin
cch:=cback div ch[j];
if cch>0 then
begin
y:=y+1;
if ch[j]=100 then
begin
gotoxy (4,10+i+y); writeln(#62#32,cch,b,a,d,ch[j],#32#32#47#32,cch,e);
end;
if (ch[j]=200) or (ch[j]=500) then
begin
gotoxy (4,10+i+y); writeln(#62#32,cch,b,a,d,ch[j]);
end;
if ch[j]>500 then
begin
gotoxy (4,10+i+y); writeln(#62#32,cch,c,a,d,ch[j]);
end;
cback:=cback mod ch[j];
end;
end;
end;
if cback<0 then
begin
gotoxy (17,17); write ('Uang Anda Kurang!');
end;
gotoxy (57,20); write ('Try Again? (Y/N) : '); readln (f);
until (f='n') or (f='N');
end.
Tidak ada komentar:
Posting Komentar