1. Write a simple decryption program using string functions which will apply the Substitution Method. Here is the given Substitution Table.
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
 char text[256];//Input text
 printf("You can use only */$+=\n");
 printf("Enter encrypt text: ");
 fgets(text,256,stdin);//get line-text
 for(unsigned i=0;i<strlen(text);i++)
  {
   //Decrypte use given table
   switch(text[i])
    {
     case '*':text[i]='A';break;
     case '$':text[i]='E';break;
     case '/':text[i]='I';break;
     case '+':text[i]='O';break;
     case '=':text[i]='U';break;
    }
  }
 printf("Decrypt text:=%s\n",text);
 return 0;
}
Comments
Leave a comment