Silahkan COPAS sesuka hati anda
Dijamin 100% BISA
#include <cstdlib>
#include <iostream>
#include <string.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
char inmsg[1000];
int i, j, length, choice;
cout<<"Masukkan kalimat: ";
cin.getline(inmsg,100);
length=strlen(inmsg);
cout<<"Masukkan kunci : ";
cin>>choice;
for(i=0;i<length;i++){
if(isalpha(inmsg[i])){
inmsg[i]=tolower(inmsg[i]);
for(j=0;j<choice;j++){
if(inmsg[i]=='z'){
inmsg[i]='a';
}
else{
inmsg[i]++;
}
}
}
}
cout<<"Hasil Enkripsinya adalah \""<<inmsg<<"\"\"\n";
system("PAUSE");
return 0;
}
Tidak ada komentar:
Posting Komentar