Kali ini saya
akan memposting koding pemrograman “Tampil Data”, yaitu koding yang jika
masukkan data yang sudah ada akan muncul tulisan error. Contoh dalam kehidupan
sehari-harinya adalah ketika membuat Username suatu akun.
Program Tampil_data;
Uses wincrt;
Var
n, i, j:integer;
x:array [1..100] of integer;
Begin
Write ('Masukkan banyak data ='); readln (n);
Writeln;
for i:=1 to n do
Begin
Write ('Data ke-',i,'= '); readln (x[i]);
End;
Writeln;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n do
if x[i]=x[i+1] then
Writeln
else
begin
Writeln ('Data ke-',i,'= ',x[i]);
end;
End.
Uses wincrt;
Var
n, i, j:integer;
x:array [1..100] of integer;
Begin
Write ('Masukkan banyak data ='); readln (n);
Writeln;
for i:=1 to n do
Begin
Write ('Data ke-',i,'= '); readln (x[i]);
End;
Writeln;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n-1 do
for j:=i+1 to n do
Begin
if x[i]=x[j] then
x[j]:=x[j+1]
End;
for i:=1 to n do
if x[i]=x[i+1] then
Writeln
else
begin
Writeln ('Data ke-',i,'= ',x[i]);
end;
End.
0 komentar:
Posting Komentar