Answer to Question #332870 in C++ for Cool

Question #332870

1. Write a simple decryption program using string functions which will apply the Substitution Method. Here is the given Substitution Table.


1
Expert's answer
2022-04-26T09:28:13-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS