mmm ...
This one cooperative program that uses the pascal program and enter data into a text input with extension. dat
program is also quite a bit complicated, but for what's wrong with learning materials in the share?
check this sources:
program sales;
uses crt;
type
data = record
no, number: integer;
nama_barang: string;
price, harga_barang: real;
end;
var
rdata: array [1 .. 100] of the data;
filedata: file of data;
f: data;
number: integer;
datacari: string;
procedure title;
begin
writeln ('COOP STUDENTS' KHARISMA KARAWANG "');
writeln ('jl. Pangkal Struggle KM.1 By Pass');
writeln ('KARAWANG');
writeln ('*********************************************** *******************');
writeln;
end;
procedure added;
var
i: integer;
again: char;
begin
clrscr;
title;
writeln ('Enter the additional data');
assign (filedata, 'jual.dat');
reset (filedata);
seek (filedata, filesize (filedata));
write ('Item:');
readln (f.nama_barang);
write ('price:');
readln (f.harga);
write ('amount:');
readln (f.jumlah);
f.harga_barang: = f.harga * f.jumlah;
write (filedata, f);
close (filedata);
end;
delete procedure;
var
i, j: integer;
nm: string;
begin
assign (filedata, 'jual.dat');
reset (filedata);
j: = 0;
while not eof (filedata) do
begin
inc (j);
read (filedata, rdata [j]);
end;
writeln ('Enter the name of the item be deleted:');
readln (nm);
i: = 1;
while (i <= j) and (rdata [i]. nama_barang <> nm) do
inc (i);
if nm = rdata [i]. nama_barang then
begin
dec (j);
for i: = i to j do
rdata [i]: = rdata [i +1];
rewrite (filedata);
for i: = 1 to j do
write (filedata, rdata [i]);
writeln ('Press enter to start the delete');
readln;
writeln ('S N K S E S');
end
else
writeln ('SORRY data not found');
readln;
close (filedata);
end;
edit_data procedure;
var
i, p: integer;
again: char;
dataedit: string;
begin
assign (filedata, 'jual.dat');
reset (filedata);
writeln ('input the name of the data to be edited [written in small letters]:');
readln (dataedit);
i: = 1;
while not eof (filedata) do
begin
read (filedata, rdata [i]);
begin
if dataedit = rdata [i]. nama_barang then
begin
p: = filepos (filedata); writeln (p);
p: = p-1;
seek (filedata, p);
writeln ('input surrogate data:');
writeln ('no', i: 2);
write ('item name:'); read (rdata [p]. nama_barang);
write ('price:'); read (rdata [p]. price);
write ('number'); read (rdata [p]. number);
rdata [p]. harga_barang: = rdata [p]. price * rdata [p]. number;
write (filedata, rdata [p]);
end;
end;
i: = i +1;
end;
close (filedata);
end;
in_data_barang procedure;
var i: integer;
again: char;
begin
i: = 1;
assign (filedata, 'jual.dat');
rewrite (filedata);
reset (filedata);
begin
repeat
begin
clrscr;
title;
writeln ('input to lowercase');
writeln ('no', i);
write ('item name:'); readln (rdata [i]. nama_barang);
write ('price:'); readln (rdata [i]. price);
write ('number'); readln (rdata [i]. number);
rdata [i]. harga_barang: = rdata [i]. price * rdata [i]. number;
write (filedata, rdata [i]);
writeln;
writeln ('want to input the data again [y / t]:');
readln (again);
i: = i +1;
end;
until ((again = 't') or (again = 'T'));
close (filedata);
end;
end;
tampil_daftar_barang procedure;
var i: integer;
begin
assign (filedata, 'jual.dat');
reset (filedata);
writeln ('LIST OF GOODS IN THE $ 1,000,000');
writeln ('=============================================== ==============');
writeln ('NO NAME OF STOCK PRICE / S TOTAL');
writeln ('=============================================== ==============');
i: = 1;
while not eof (filedata) do
begin
read (filedata, rdata [i]);
if (rdata [i]. price)> = 1000000 then
begin
write (i);
write ('', rdata [i]. nama_barang: 10);
write ('', rdata [i]. price: 10:0);
write ('', rdata [i]. number: 2);
writeln;
i: = i +1;
end;
end; writeln;
end;
cetak_daftar_barang procedure;
var i, select: integer;
total: real;
begin
repeat
clrscr;
assign (filedata, 'jual.dat');
reset (filedata);
total: = 0;
begin
title;
writeln ('LIST SALES');
writeln ('=============================================== ===========================');
writeln ('NO NAME OF STOCK PRICE / S TOTAL PRICE OF GOODS');
writeln ('=============================================== ===========================');
i: = 1;
while not eof (filedata) do
begin
read (filedata, rdata [i]);
write (i);
write ('', rdata [i]. nama_barang: 10);
write ('', rdata [i]. price: 10:0);
write ('', rdata [i]. number: 2);
write ('', rdata [i]. harga_barang: 8:0);
writeln;
total: = total + rdata [i]. harga_barang;
i: = i +1;
end;
writeln ('----------------------------------------------- ----------------------');
writeln ('TOTAL SALES;', Total: 3:0);
writeln;
writeln;
tampil_daftar_barang;
end;
writeln ('- Choice --');
writeln ('**************************');
writeln ('1. Add sales data ');
writeln ('2. Remove the sales data ');
writeln ('3. Edit the sales data ');
writeln ('4. Go to the Main MENU ');
writeln ('**************************');
readln (choice);
case select of
1: add;
2: delete;
3: edit_data;
end;
until (select = 4);
end;
search procedure;
var
i, number: integer;
match, name: string;
price, harga_barang: real;
begin
assign (filedata, 'jual.dat');
reset (filedata);
match: = datacari;
begin
i: = 1;
while not eof (filedata) do
begin
read (filedata, rdata [i]);
if matches = rdata [i]. nama_barang then
begin
name: = rdata [i]. nama_barang;
Price: = rdata [i]. price;
number: = rdata [i]. number;
harga_barang: = rdata [i]. harga_barang;
end;
end;
i: = i +1;
end;
if (name ='') then
begin
writeln ('SORRY NO DATA AVAILABLE ")
end
else
begin
title;
writeln ('LIST SEARCH');
writeln ('=============================================== =======================');
writeln ('NAME OF GOODS PRICE / S TOTAL PRICE OF GOODS');
writeln ('=============================================== =======================');
writeln;
Write (name: 10);
write (price: 35:0);
write (number: 8);
write (harga_barang: 12:0);
writeln;
writeln ('----------------------------------------------- --------------------------');
writeln;
end;
:=''; name
Price: = 0;
number: = 0;
harga_barang: = 0;
end;
cek_data_barang procedure;
var
again: char;
begin
repeat
clrscr;
title;
writeln ('Enter the name of the data in search [written in small letters]:');
readln (datacari);
clrscr;
search;
writeln ('Do want to find the data again? [y / t]');
readln (again);
writeln;
until (again = 'T') or (again = 't');
end;
begin
repeat
clrscr;
title;
writeln ('- MENU --');
writeln ('************************');
writeln ('1. IN GOODS DATA ');
writeln ('2. CHECK DATA ITEM ');
writeln ('3. PRINT LIST OF GOODS ');
writeln ('4. E X I T ');
writeln ('************************');
writeln;
writeln ('Select Transaction Type =');
readln (number);
clrscr;
case number of
1: in_data_barang;
2: cek_data_barang;
3: cetak_daftar_barang;
end;
until number = 4;
end.
for my friends who want to program in the form of extensions. textnya fit and in shape. dat
can be downloaded here:
Click Here
Do not Just Copy Paste Continue to Smile, But Let's Learn And try to show creativity.
Information
Monday, July 18, 2011
Subscribe to:
Post Comments (Atom)
Namaste,
ReplyDeleteAt line 374:4 ("1: in_data_barang;") it gives me the "Error 3: Unknown identifier" and I could not find the reason, I've checked all the lines from "in_data_barang procedure".
Could you please help me?
Can you tell me what the version of pascal you use ?
DeleteThis comment has been removed by the author.
ReplyDeleteTurbo Pascal Version 7.0
ReplyDelete