Selamat Pagi, Mas.
Berikut saya kirimkan Materi E-Learning utk Mata Kuliah
Pend Agama #2 . Setelah mempelajari dan memahami dari
materi yang diberikan, diharap untuk mengerjakan Tigas
Evaluasi dan dikirim via e-mail paling lambat tgl 3 Minggu
setelah pengiriman materi ini.
Alamat E-mail : sudar_yono91@yahoo.com
Format Subject : Evaluasi Tugas Pend Agama #2 Nama Pengirim
Depok, 26 Pebruari 2013
Koordinator
http://www.facebook.com/download/159420454215668/MATERI%20E-LEARNING%20PEND%20AGAMA%202%23.docx
Monday, February 25, 2013
Saturday, January 5, 2013
Program COBOL untuk baca file sequential
kemaren baru saja saya share program C untuk baca file, kali ini saya akan memberikan program COBOL untuk baca file, berikut adalah listingnya :
IDENTIFICATION DIVISION.
PROGRAM-ID. SR.
AUTHOR. JUNIOR.
DATE-WRITTEN. 04-11-2012.
DATE-COMPILED. 04-11-2012.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DEPARTS ASSIGN TO DISK
ORGANIZATION IS LINE SEQUENTIAL
FILE STATUS IS OUT.
DATA DIVISION.
FILE SECTION.
FD DEPARTS
LABEL RECORD IS STANDARD
VALUE OF FILE-ID IS 'AIRLINES.txt'
DATA RECORD IS DEPARTLIST.
01 DEPARTLIST.
02 A PIC X(3).
02 CODES PIC X(9).
02 B PIC X(3).
02 DESTIN PIC X(7).
02 C PIC X(3).
02 TIM PIC X(5).
WORKING-STORAGE SECTION.
77 OUT PIC XX.
01 DEPARTS-OUT.
02 A-OUT PIC X(3).
02 CODES-OUT PIC X(9).
02 B-OUT PIC X(3).
02 DESTIN-OUT PIC X(7).
02 C-OUT PIC X(3).
02 TIM-OUT PIC X(5).
01 GARIS PIC X(34) VALUE ALL '-'.
SCREEN SECTION.
01 HAPUS.
02 BLANK SCREEN.
01 JUDUL.
02 LINE 4 COLUMN 2 '| LIST OF DEPARTURES |'.
02 LINE 5 COLUMN 2 PIC X(34) USING GARIS.
02 LINE 6 COLUMN 2 '| PLANE-CODE DESTINATION TIME |'.
02 LINE 7 COLUMN 2 PIC X(34) USING GARIS.
PROCEDURE DIVISION.
BUKA-FILE.
OPEN INPUT DEPARTS.
MULAI.
DISPLAY HAPUS.
MOVE 8 TO LIN.
DISPLAY JUDUL.
BACA.
READ DEPARTS INTO DEPARTS-OUT
AT END GO TO SELESAI.
TAMPILKAN.
DISPLAY (LIN, 2) DEPARTS-OUT,
ADD 1 TO LIN.
GO TO BACA.
SELESAI.
DISPLAY (LIN, 2) GARIS.
CLOSE DEPARTS.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. SR.
AUTHOR. JUNIOR.
DATE-WRITTEN. 04-11-2012.
DATE-COMPILED. 04-11-2012.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DEPARTS ASSIGN TO DISK
ORGANIZATION IS LINE SEQUENTIAL
FILE STATUS IS OUT.
DATA DIVISION.
FILE SECTION.
FD DEPARTS
LABEL RECORD IS STANDARD
VALUE OF FILE-ID IS 'AIRLINES.txt'
DATA RECORD IS DEPARTLIST.
01 DEPARTLIST.
02 A PIC X(3).
02 CODES PIC X(9).
02 B PIC X(3).
02 DESTIN PIC X(7).
02 C PIC X(3).
02 TIM PIC X(5).
WORKING-STORAGE SECTION.
77 OUT PIC XX.
01 DEPARTS-OUT.
02 A-OUT PIC X(3).
02 CODES-OUT PIC X(9).
02 B-OUT PIC X(3).
02 DESTIN-OUT PIC X(7).
02 C-OUT PIC X(3).
02 TIM-OUT PIC X(5).
01 GARIS PIC X(34) VALUE ALL '-'.
SCREEN SECTION.
01 HAPUS.
02 BLANK SCREEN.
01 JUDUL.
02 LINE 4 COLUMN 2 '| LIST OF DEPARTURES |'.
02 LINE 5 COLUMN 2 PIC X(34) USING GARIS.
02 LINE 6 COLUMN 2 '| PLANE-CODE DESTINATION TIME |'.
02 LINE 7 COLUMN 2 PIC X(34) USING GARIS.
PROCEDURE DIVISION.
BUKA-FILE.
OPEN INPUT DEPARTS.
MULAI.
DISPLAY HAPUS.
MOVE 8 TO LIN.
DISPLAY JUDUL.
BACA.
READ DEPARTS INTO DEPARTS-OUT
AT END GO TO SELESAI.
TAMPILKAN.
DISPLAY (LIN, 2) DEPARTS-OUT,
ADD 1 TO LIN.
GO TO BACA.
SELESAI.
DISPLAY (LIN, 2) GARIS.
CLOSE DEPARTS.
STOP RUN.
Program C untuk membaca semua file di dalam suatu folder
Berikut ini adalah program C yang berguna untuk melakukan seleksi secara otomatis terhadap abstrak paper yang ada di suatu folder "Files". Hasil seleksi akan otomatis masuk ke dalam txt baru yang bernama "Result.txt". Dan juga program ini akan menghitung jumlah kata dan ada tidaknya keyword di dalam abstrak tersebut dan semua itu tergantung oleh tema dari abstrak itu sendiri. Berikut adalah listing programnya :
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <conio.h>
int main(void) {
int args = 0;
char lokasi[64] = "Files\\";
DIR *directory;
struct dirent *ep;
directory = opendir(lokasi);
FILE *fp,*dt;
char str1[80];
char Skey1[10]="visual";
char Skey2[10]="tradition";
char Skey3[10]="animals";
char Skey4[10]="relations";
int Itheme;
int Istats=0;
int Iword=1;
int Imin;
if (directory != NULL)
{
while (args != 2)
{
ep = readdir(directory);
args++;
}
args = 1;
while (ep = readdir(directory))
{
system("cls");
char lokasi[64] = "Files\\";
int Istats=0;
int Iword=1;
fp = fopen(strcat(lokasi, ep->d_name),"r");
printf("***Abstract checker program***");
printf("\n**Junior Lie-SMTI06-53411891**");
printf("\nThe file name is [%s] ",ep->d_name);
printf("\nEnter the theme : ");
printf("\n1. Arts ");
printf("\n2. Humanities ");
printf("\n3. Science");
printf("\n4. SocialScience\n");
scanf("%d",&Itheme);
if(Itheme==1){Imin=150;}
else if(Itheme==2){Imin=250;}
else if(Itheme==3){Imin=220;}
else if(Itheme==4){Imin=200;}
dt = fopen("Reply.txt", "a");
rewind(fp);
while (!feof(fp))
{
fscanf(fp, "%s",str1);
Iword++;
if(Itheme==1){if((strstr(str1,Skey1))!=NULL){Istats=1;}}
else if(Itheme==2){if((strstr(str1,Skey2))!=NULL){Istats=1;}}
else if(Itheme==3){if((strstr(str1,Skey3))!=NULL){Istats=1;}}
else if(Itheme==4){if((strstr(str1,Skey4))!=NULL){Istats=1;}}
}
printf("\nWords : %d",Iword);
printf("\nMinimum words : %d",Imin);
if(Itheme==1){printf("\nThe keyword for this theme is \"%s\"",Skey1);}
else if(Itheme==2){printf("\nThe keyword for this theme is \"%s\"",Skey2);}
else if(Itheme==3){printf("\nThe keyword for this theme is \"%s\"",Skey3);}
else if(Itheme==4){printf("\nThe keyword for this theme is \"%s\"",Skey4);}
printf("\nThe file was successfully checked. Check Reply.txt for the result\n");
fclose(fp);
if (Iword < Imin){
fprintf(dt,"\n%s - Sorry we have rejected your abstract, as the number of words that are not eligible \n",ep->d_name);
}
else if(Istats==0){
fprintf(dt,"\n%s - Sorry we have rejected your abstract, because it does not contain the keyword \n",ep->d_name);
}
else{
fprintf(dt,"\n%s - Congratulations! We have approved your abstract !",ep->d_name);
}
fclose(dt);
args++;
getch();}
closedir(directory);
}
else
{
printf("Directory not found!");
}
}
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <conio.h>
int main(void) {
int args = 0;
char lokasi[64] = "Files\\";
DIR *directory;
struct dirent *ep;
directory = opendir(lokasi);
FILE *fp,*dt;
char str1[80];
char Skey1[10]="visual";
char Skey2[10]="tradition";
char Skey3[10]="animals";
char Skey4[10]="relations";
int Itheme;
int Istats=0;
int Iword=1;
int Imin;
if (directory != NULL)
{
while (args != 2)
{
ep = readdir(directory);
args++;
}
args = 1;
while (ep = readdir(directory))
{
system("cls");
char lokasi[64] = "Files\\";
int Istats=0;
int Iword=1;
fp = fopen(strcat(lokasi, ep->d_name),"r");
printf("***Abstract checker program***");
printf("\n**Junior Lie-SMTI06-53411891**");
printf("\nThe file name is [%s] ",ep->d_name);
printf("\nEnter the theme : ");
printf("\n1. Arts ");
printf("\n2. Humanities ");
printf("\n3. Science");
printf("\n4. SocialScience\n");
scanf("%d",&Itheme);
if(Itheme==1){Imin=150;}
else if(Itheme==2){Imin=250;}
else if(Itheme==3){Imin=220;}
else if(Itheme==4){Imin=200;}
dt = fopen("Reply.txt", "a");
rewind(fp);
while (!feof(fp))
{
fscanf(fp, "%s",str1);
Iword++;
if(Itheme==1){if((strstr(str1,Skey1))!=NULL){Istats=1;}}
else if(Itheme==2){if((strstr(str1,Skey2))!=NULL){Istats=1;}}
else if(Itheme==3){if((strstr(str1,Skey3))!=NULL){Istats=1;}}
else if(Itheme==4){if((strstr(str1,Skey4))!=NULL){Istats=1;}}
}
printf("\nWords : %d",Iword);
printf("\nMinimum words : %d",Imin);
if(Itheme==1){printf("\nThe keyword for this theme is \"%s\"",Skey1);}
else if(Itheme==2){printf("\nThe keyword for this theme is \"%s\"",Skey2);}
else if(Itheme==3){printf("\nThe keyword for this theme is \"%s\"",Skey3);}
else if(Itheme==4){printf("\nThe keyword for this theme is \"%s\"",Skey4);}
printf("\nThe file was successfully checked. Check Reply.txt for the result\n");
fclose(fp);
if (Iword < Imin){
fprintf(dt,"\n%s - Sorry we have rejected your abstract, as the number of words that are not eligible \n",ep->d_name);
}
else if(Istats==0){
fprintf(dt,"\n%s - Sorry we have rejected your abstract, because it does not contain the keyword \n",ep->d_name);
}
else{
fprintf(dt,"\n%s - Congratulations! We have approved your abstract !",ep->d_name);
}
fclose(dt);
args++;
getch();}
closedir(directory);
}
else
{
printf("Directory not found!");
}
}
Tuesday, December 18, 2012
Program Pascal Linked List
program linkedlist2;
uses crt;
type data = record
nama,npm,tgl : array[1..10]of string;
alamat,link: array[1..10]of integer;
end;
var list: array[1..10]of integer;
asc,desc : array[1..10]of string;
mhs : data;
avail,i,isi,opsi,del,start,temp,temp2,ujung: integer;
procedure Ascending;
var x, y, Imax : integer;
Smax, temp3 : string;
begin
for x := 1 to 10 do
begin
Smax := asc[x];
for y := x to 10 do
begin
if (asc[y] <= Smax) then
begin
Smax := asc[y];
Imax := y;
end;
end;
temp3 := asc[x];
asc[x] := asc[Imax];
asc[Imax] := temp3;
end;
end;
procedure Descending;
var x, y, Imin : integer;
Smin, temp4 : string;
begin
for x := 1 to 10 do
begin
Smin := desc[x];
for y := x to 10 do
begin
if (desc[y] >= Smin) then
begin
Smin := desc[y];
Imin := y;
end;
end;
temp4 := desc[x];
desc[x] := desc[Imin];
desc[Imin] := temp4;
end;
end;
procedure cekavail;
var j : integer;
begin
for j:=1 to 10 do
begin
if mhs.link[avail]=0 then
begin
temp:=0;
break;
end
else if mhs.link[avail]=mhs.alamat[j] then
begin
if mhs.nama[j]='' then
begin
temp:=j;
break;
end;
end;
end;
end;
procedure menu;
begin
clrscr;
writeln(' PROGRAM LINKED LIST (MENGGUNAKAN AVAIL)');
writeln(' |Alamat| Nama | NPM | Tgl.Lahir | Link |');
for i := 1 to 10 do
begin
asc[i]:=mhs.nama[i];
desc[i]:=mhs.nama[i];
mhs.alamat[i]:=i;
gotoxy(10,i+2);write('|',mhs.alamat[i]);
gotoxy(17,i+2);write('|',mhs.nama[i]);
gotoxy(24,i+2);writeln('|',mhs.npm[i]);
gotoxy(32,i+2);writeln('|',mhs.tgl[i]);
gotoxy(44,i+2);writeln('| ',mhs.link[i],' |');
end;
if isi=0 then
begin
avail:=3;
start:=3;
end
else
begin
avail:=temp;
for i:=1 to isi do
begin
if list[i]<>0 then
begin
start:=list[i];
break;
end;
end;
end;
if avail<>0 then
begin
gotoxy(52,avail+2);write(' << AVAIL ');
end;
gotoxy(1,start+2);write('START >> ');
list[isi+1]:=avail;
gotoxy(1,13);writeln('AVAIL : ',avail);
gotoxy(1,14);writeln('1. List ');
gotoxy(1,15);writeln('2. Insert ');
gotoxy(1,16);writeln('3. Delete ');
gotoxy(14,14);writeln('4. Ascending Sort ');
gotoxy(14,15);writeln('5. Descending Sort ');
gotoxy(14,16);writeln('6. Exit ');
write('Select your choice : ');readln(opsi);
if opsi =1 then
begin
if isi=0 then
begin
writeln('THERE IS NO DATA !');
readln;
menu;
end
else
begin
for i:=1 to isi do
begin
if list[i]<>0 then
begin
write('[',mhs.nama[list[i]],']');
if i<>isi then write(' >> ');
end;
end;
readln;
menu;
end;
end
else if opsi =2 then
begin
if (avail=0) then
begin
writeln('ERROR : DATA OVERFLOW');
readln;
menu;
end
else
begin
inc(isi);
write('Masukkan nama : ');readln(mhs.nama[avail]);
write('Masukkan npm : ');readln(mhs.npm[avail]);
write('Masukkan tanggal lahir : ');readln(mhs.tgl[avail]);
temp2:=avail;
if isi<>1 then mhs.link[list[isi-1]]:=temp2;
cekavail;
mhs.link[avail]:=0;
menu;
end;
end
else if opsi =3 then
begin
if isi=0 then
begin
writeln('ERROR: DATA UNDERFLOW');
readln;
menu;
end
else
begin
write('Data pada alamat keberapa yang akan dihapus ? ');readln(del);
mhs.nama[del]:='';mhs.npm[del]:='';mhs.tgl[del]:='';
for i:=1 to 10 do
begin
if mhs.link[i]=del then
begin
mhs.link[i]:=mhs.link[del];
break;
end;
end;
mhs.link[del]:=0;
mhs.link[ujung]:=del;
ujung:=del;
for i:=1 to 10 do
begin
if list[i]=del then
begin
list[i]:=0;
break;
end;
end;
menu;
end;
end
else if opsi=4 then
begin
ascending;
for i:= 1 to 10 do
begin
if asc[i]<>'' then
begin
write('[',asc[i],']');
if i<>10 then write(' >> ');
end;
end;
readln;
menu;
end
else if opsi=5 then
begin
descending;
for i:= 1 to 10 do
begin
if desc[i]<>'' then
begin
write('[',desc[i],']');
if i<>10 then write(' >> ');
end;
end;
readln;
menu;
end;
end;
begin {program utama}
isi:=0;
mhs.link[1]:=7;
mhs.link[2]:=4;
mhs.link[3]:=5;
mhs.link[4]:=10;
mhs.link[5]:=1;
mhs.link[6]:=8;
mhs.link[7]:=9;
mhs.link[8]:=0;
mhs.link[9]:=2;
mhs.link[10]:=6;
ujung:=8;
menu;
end.
uses crt;
type data = record
nama,npm,tgl : array[1..10]of string;
alamat,link: array[1..10]of integer;
end;
var list: array[1..10]of integer;
asc,desc : array[1..10]of string;
mhs : data;
avail,i,isi,opsi,del,start,temp,temp2,ujung: integer;
procedure Ascending;
var x, y, Imax : integer;
Smax, temp3 : string;
begin
for x := 1 to 10 do
begin
Smax := asc[x];
for y := x to 10 do
begin
if (asc[y] <= Smax) then
begin
Smax := asc[y];
Imax := y;
end;
end;
temp3 := asc[x];
asc[x] := asc[Imax];
asc[Imax] := temp3;
end;
end;
procedure Descending;
var x, y, Imin : integer;
Smin, temp4 : string;
begin
for x := 1 to 10 do
begin
Smin := desc[x];
for y := x to 10 do
begin
if (desc[y] >= Smin) then
begin
Smin := desc[y];
Imin := y;
end;
end;
temp4 := desc[x];
desc[x] := desc[Imin];
desc[Imin] := temp4;
end;
end;
procedure cekavail;
var j : integer;
begin
for j:=1 to 10 do
begin
if mhs.link[avail]=0 then
begin
temp:=0;
break;
end
else if mhs.link[avail]=mhs.alamat[j] then
begin
if mhs.nama[j]='' then
begin
temp:=j;
break;
end;
end;
end;
end;
procedure menu;
begin
clrscr;
writeln(' PROGRAM LINKED LIST (MENGGUNAKAN AVAIL)');
writeln(' |Alamat| Nama | NPM | Tgl.Lahir | Link |');
for i := 1 to 10 do
begin
asc[i]:=mhs.nama[i];
desc[i]:=mhs.nama[i];
mhs.alamat[i]:=i;
gotoxy(10,i+2);write('|',mhs.alamat[i]);
gotoxy(17,i+2);write('|',mhs.nama[i]);
gotoxy(24,i+2);writeln('|',mhs.npm[i]);
gotoxy(32,i+2);writeln('|',mhs.tgl[i]);
gotoxy(44,i+2);writeln('| ',mhs.link[i],' |');
end;
if isi=0 then
begin
avail:=3;
start:=3;
end
else
begin
avail:=temp;
for i:=1 to isi do
begin
if list[i]<>0 then
begin
start:=list[i];
break;
end;
end;
end;
if avail<>0 then
begin
gotoxy(52,avail+2);write(' << AVAIL ');
end;
gotoxy(1,start+2);write('START >> ');
list[isi+1]:=avail;
gotoxy(1,13);writeln('AVAIL : ',avail);
gotoxy(1,14);writeln('1. List ');
gotoxy(1,15);writeln('2. Insert ');
gotoxy(1,16);writeln('3. Delete ');
gotoxy(14,14);writeln('4. Ascending Sort ');
gotoxy(14,15);writeln('5. Descending Sort ');
gotoxy(14,16);writeln('6. Exit ');
write('Select your choice : ');readln(opsi);
if opsi =1 then
begin
if isi=0 then
begin
writeln('THERE IS NO DATA !');
readln;
menu;
end
else
begin
for i:=1 to isi do
begin
if list[i]<>0 then
begin
write('[',mhs.nama[list[i]],']');
if i<>isi then write(' >> ');
end;
end;
readln;
menu;
end;
end
else if opsi =2 then
begin
if (avail=0) then
begin
writeln('ERROR : DATA OVERFLOW');
readln;
menu;
end
else
begin
inc(isi);
write('Masukkan nama : ');readln(mhs.nama[avail]);
write('Masukkan npm : ');readln(mhs.npm[avail]);
write('Masukkan tanggal lahir : ');readln(mhs.tgl[avail]);
temp2:=avail;
if isi<>1 then mhs.link[list[isi-1]]:=temp2;
cekavail;
mhs.link[avail]:=0;
menu;
end;
end
else if opsi =3 then
begin
if isi=0 then
begin
writeln('ERROR: DATA UNDERFLOW');
readln;
menu;
end
else
begin
write('Data pada alamat keberapa yang akan dihapus ? ');readln(del);
mhs.nama[del]:='';mhs.npm[del]:='';mhs.tgl[del]:='';
for i:=1 to 10 do
begin
if mhs.link[i]=del then
begin
mhs.link[i]:=mhs.link[del];
break;
end;
end;
mhs.link[del]:=0;
mhs.link[ujung]:=del;
ujung:=del;
for i:=1 to 10 do
begin
if list[i]=del then
begin
list[i]:=0;
break;
end;
end;
menu;
end;
end
else if opsi=4 then
begin
ascending;
for i:= 1 to 10 do
begin
if asc[i]<>'' then
begin
write('[',asc[i],']');
if i<>10 then write(' >> ');
end;
end;
readln;
menu;
end
else if opsi=5 then
begin
descending;
for i:= 1 to 10 do
begin
if desc[i]<>'' then
begin
write('[',desc[i],']');
if i<>10 then write(' >> ');
end;
end;
readln;
menu;
end;
end;
begin {program utama}
isi:=0;
mhs.link[1]:=7;
mhs.link[2]:=4;
mhs.link[3]:=5;
mhs.link[4]:=10;
mhs.link[5]:=1;
mhs.link[6]:=8;
mhs.link[7]:=9;
mhs.link[8]:=0;
mhs.link[9]:=2;
mhs.link[10]:=6;
ujung:=8;
menu;
end.
Subscribe to:
Posts (Atom)