Popular Download

Jul 21, 2011

encrypt or decrypt number

encrypt or decrypt code by: John Gerald Catague
Program language dev C++
proposes to compute the water expenses
note Dis code is open source you can edit the code as lone you want but
do note remove the copyright comment in the code thank you
*for Educational purposes only
code below
note dont forget the brace in
#include iostream
#include iomanip
#include cmath
**********************************************************************************

#include iostream
#include iomanip
#include cmath
using namespace std;
char action;
//code by John GErald Catague
//visit http://cataguegerald.blogspot.com for more info
int main ()

{
int number;

cout << "Enter e to encrypt or d to decrypt?" << endl; cin >> action;

if( action == 'e')
{
cout << " Enter a 4 digit number to encrypt: " << endl; cin >> number;

int digit1 = ( number / 1000 + 7) % 10;
int digit2 = ( number % 1000 / 100 + 7) % 10;
int digit3 = ( number % 100 / 10 + 7 ) % 10;
int digit4 = ( number % 10 + 7) % 10;

int encryptedNumber =
digit1 * 10 + digit2 + digit3 * 1000 + digit4 * 100;

cout << " Encrypted Number is:" << encryptedNumber << endl; } else if ( action == 'd'); cout << "Enter a 4-digit number to decrypt: " << endl; cin >> number;


// decrypt ( digit numbers are counted from left)
int digit1 = ( number / 1000 + 3) % 10;
int digit2 = ( number % 1000 / 100 + 3) % 10;
int digit3 = ( number % 100 / 10 + 3 ) % 10;
int digit4 = ( number % 10 + 3) % 10;

int decryptedNumber =
digit1 * 10 + digit2 + digit3 * 1000 + digit4 * 100;

cout << " Decrypted Number is:" << decryptedNumber << endl;
system("pause");
}

1 comment:

  1. The best casinos to play at a Las Vegas casino - JTHub
    You can earn points for every 3 바카라사이트 minutes at all of the casino 사천 출장샵 slot 여주 출장안마 machines. The best online 시흥 출장샵 casinos have a lot of features, including games that pay out. 삼척 출장샵

    ReplyDelete