[C++] Caesar Chiper Enkripsi dengan C++

Caesar Chiper adalah bla bla bla goleki dewe ning google..

NYOOHH!!

[sourcecode language=”php”]

#include
#include
#include
#define maks 500

using namespace std;
class Enkripsi{
public:
Enkripsi();
void enkripsi();
void deskripsi();
void output();
private:
char chiper[maks];
int key;
char plain[maks];
};
Enkripsi::Enkripsi(){
cout<<"Masukkan kata : ";
cin.getline(chiper,sizeof(chiper));
cout<<"Masukkan key : ";
cin>>key;
cout< }
void Enkripsi::enkripsi(){
for(int i=0;i cout< chiper[i] = (chiper[i]+key)%128;
}
}
void Enkripsi::deskripsi(){
for(int i=0;i plain[i]=(chiper[i]-key)%128;
chiper[i] = plain[i];
}
}
void Enkripsi::output(){
for(int i=0;i cout< }
}
int main(int argc,char *argv[])
{
Enkripsi Deskripsi;
Deskripsi.enkripsi();
cout<<”\n\nSetelah dienkripsi: “;
Deskripsi.output();
Deskripsi.deskripsi();
cout<<”\n\nKembali diDeskripsi: “;
Deskripsi.output();
cout< system(“PAUSE”);
return EXIT_SUCCESS;
}

[/sourcecode]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>