usingnamespacestd; int x = 0; voidbegin() { puts("===================================================================="); puts("1.Encrypt"); puts("2.Decrypt"); puts("3.Exit"); puts("Input your choice!"); }
voidencrypt() { char s[48]; memset(s, 0, sizeof(s)); puts("Input your Plaintext to be encrypted"); cin >> s; while( strlen(s) > (unsignedint)x ) { if( s[x] <= 96 || s[x] > 122 ) { if( s[x] <= 64 || s[x] > 90 ) { if(s[x] > 47 && s[x] <= 57) s[x] ^= 0xf; } else { s[x] ^= 14; } } else { s[x] ^= 13; } ++x; } s[47] = '\0'; puts("Ciphertext"); } intmain() { int input; puts("EEEEEEE hh iii "); puts("EE mm mm mmmm aa aa cccc hh nn nnn eee "); puts("EEEEE mmm mm mm aa aaa cc hhhhhh iii nnn nn ee e "); puts("EE mmm mm mm aa aaa cc hh hh iii nn nn eeeee "); puts("EEEEEEE mmm mm mm aaa aa ccccc hh hh iii nn nn eeeee "); puts("===================================================================="); puts("Welcome to this Encryption machine\n"); begin(); while(1) { while(1) { fflush(0); scanf("%d", &input); getchar(); if(input != 2) break; puts("I think you can do it by yourself"); begin(); } if(input == 3) { puts("Bye!"); return0; } if( input != 1 ) break; encrypt(); begin(); } puts("Something Wrong!"); return0; }