Tipe Data Lanjut, Pointer, & Operasi File : Program Decryptor File Teks Eksternal

8 12 2009

8. Buat sebuah program decryptor file teks eksternal untuk mendapatkan soal shift kelompok Anda!

File teks dan jenis enkripsi yang digunakan masing-masing kelompok (sudah ditentukan) dapat ditanyakan dan diambil ke asisten masing-masing.

Soal Shift (Enkripsi +8) :

Dp|ut(€utv{BwE*}zvB{kpmui{5uqkzw{wn|5kwuBwnnqkmBwnnqkm*€utv{BE*}zvB{kpmui{5uqkzw{wn|5kwuBwnnqkmBwzl*€utv{E*p||xB776;6wzo7\Z7ZMK5p|ut<8*FDpmilFDum|i(p||x5my}q~EKwv|mv|5\xm(kwv|mv|E*|m€|7p|utC(kpiz{m|Eqvlw{59:=:*FDum|i(viumEXzwoQl(kwv|mv|E_wzl6Lwk}umv|FDum|i(viumEOmvmzi|wz(kwv|mv|E*Uqkzw{wn|(_wzl(99*FDum|i(viumEWzqoqvi|wz(kwv|mv|E*Uqkzw{wn|(_wzl(99*FDtqvs(zmtENqtm5Tq{|(pzmnE*5995::\:8B;;B88bD7wBKzmi|mlF((DwBTi{|[i~mlF:88>5995::\:8B;@B88bD7wBTi{|[i~mlF((DwBXiom{F9D7wBXiom{F((DwB_wzl{FA;D7wB_wzl{F((DwBKpizik|mz{F=;>D7wBKpizik|mz{F((DwBKwuxivFPwumD7wBKwuxivF((DwBTqvm{F:@D7wBKpizik|mz{_q|p[xikm{F((DwB^mz{qwvF996>=>@D7wB^mz{qwvF(D7wBLwk}umv|Xzwxmz|qm{FD7€utFD)cmvlqne55FD)55cqn(o|m(u{w(AeFD€utF(DB_wzlLwk}umv|F((DBOziuuiz[|i|mFKtmivD7BOziuuiz[|i|mF((DBX}vk|}i|qwvSmzvqvo7F((DB^itqli|mIoiqv{|[kpmui{7F((DB[i~mQn`UTQv~itqlFnit{mD7B[i~mQn`UTQv~itqlF((DBQovwzmUq€mlKwv|mv|Fnit{mD7BQovwzmUq€mlKwv|mv|F((DBIti{[pwXtikmpwtlmz\m€|F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oqv5tmn|B9@68x|/FD{xiv(tivoEQV({|tmE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\zmj}kpm|(U[*Cu{w5iv{q5tivo}iomBQV/F{|zqvo({mxizi|wzB(›4œDwBxFD7wBxFD7{xivFD7xFDx(kti{{EU{wVwzuit({|tmE/uizoqv5tmn|B9@68x|/FD{xiv(tivoEQV({|tmE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\zmj}kpm|(U[*Cu{w5iv{q5tivo}iomBQV/FDwBxF.vj{xCD7wBxFD7{xivFD7xFDx(kti{{EU{wVwzuit({|tmE/uizoqv5tmn|B9@68x|/FD{xiv(tivoEQV({|tmE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\zmj}kpm|(U[*Cu{w5iv{q5tivo}iomBQV/F7255555555555555555555555D{xiv{|tmE/kwtwzB+NN>>88/Fnqtm6|€|D7{xivF27DwBxFD7wBxFD7{xivFD7xFDx(kti{{EU{wVwzuit({|tmE/uizoqv5tmn|B9@68x|/FD{xiv(tivoEQV({|tmE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\zmj}kpm|(U[*Cu{w5iv{q5tivo}iomBQV/FXzis|qs}u(xmuzwoziuiv(|mz{|z}s|}zilitip(xzis|qs}u(ivo(umvmvivosiv4xmv}p(lmvoiv(smr}|iv(liv(pit5pit(ivo(jiz}6DwBxFD7wBxFD7{xivFD7xFDx(kti{{EU{wVwzuit({|tmE/uizoqv5tmn|B9@68x|/FDj({|tmE/u{w5jqlq5nwv|5mqop|Bvwzuit/FD{xiv(tivoEQV({|tmE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\zmj}kpm|(U[*Cu{w5iv{q5tivo}iomBQV/FDwBxF.vj{xCD7wBxFD7{xivFD7jFD7xFDx(kti{{EU{wVwzuit({|tmE/uizoqv5tmn|B9@68x|/FDj({|tmE/u{w5jqlq5nwv|5mqop|Bvwzuit/FD{xiv(tivoEQV({|tmE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\z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mE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\zmj}kpm|(U[*Cu{w5iv{q5tivo}iomBQV/FXzis|qs}u(xmuzwoziuiv|mz{|z}s|}z(ilitip(xzis|qs}u(ivo(umvmvivosivDwBxFD7wBxFD7{xivFD7xFDx(kti{{EU{wVwzuit({|tmE/uizoqv5tmn|B9@68x|/FD{xiv(tivoEQV({|tmE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\zmj}kpm|(U[*Cu{w5iv{q5tivo}iomBQV/FDwBxF.vj{xCD7wBxFD7{xivFD7xFDx(kti{{EU{wVwzuit({|tmE/uizoqv5tmn|B9@68x|/FD{xiv(tivoEQV({|tmE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\zmj}kpm|(U[*Cu{w5iv{q5tivo}iomBQV/F725555555555555555555D{xiv{|tmE/kwtwzB+NN>>88/Fnqtm:6|€|D7{xivF27DwBxFD7wBxFD7{xivFD7xFDx(kti{{EU{wVwzuit({|tmE/uizoqv5tmn|B9@68x|/FD{xiv(tivoEQV({|tmE/nwv|5{q‚mB9968x|Cnwv|5niuqtB*\zmj}kpm|(U[*Cu{w5iv{q5tivo}iomBQV/Fxmv}p(lmvoiv(smr}|ivliv(pit5pit(ivo(jiz}6DwBxFD7wBxFD7{xivFD7xFDx(kti{{EU{wVwzuitFDwBxF.vj{xCD7wBxFD7xFD7lq~FD7jwlFD7p|utF

Algoritma Program :

  1. Program membaca file “SOAL DEKRIPSI -8.htm”  dengan mode teks.
  2. Program menciptakan file “HASIL DEKRIPSI.htm”  dengan mode teks.
  3. Jika file yang dibaca tidak ada pada media penyimpanan (NULL), program akan segera keluar dari file tersebut.
  4. Jika pembacaan file berhasil, selanjutnya program akan mengecek jika karakter isi file tidak sama dengan EOF , program mendekripsikan tiap karakter dengan nilai -8.
  5. Program menampilkan hasil dekripsi ke layar.
  6. Program menuliskan hasil dekripsi tersebut pada file baru yang telah diciptakan.
  7. Program menutup file yang telah dibaca dan file baru yang telah diciptakan.

Sourcecode Program Dekriptor :

#include<stdio.h>

#include<conio.h>

#include<process.h>

#include<stdlib.h>

int main(void)

{

FILE *baca,*tulis;

char kar;

baca=fopen("SOAL DEKRIPSI -8.htm", "rt");

tulis=fopen("HASIL DEKRIPSI.htm", "wt");

if(baca == NULL)

exit(1);

while((kar=getc(baca))!=EOF)

{

kar-=8;

printf("%c",kar);

fprintf(tulis,"%c",kar);

}

fclose(baca);

fclose(tulis);

getch();

return 0;

}

Posted By : Evan Yofiyanto @ Evan’s Blog : Kuliah Informatika (kuliahinformatika.wordpress.com)

[FREAX]


Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: