USING C LANGUAGE Write one function to demonstrate the decry

USING C LANGUAGE

Write one function to demonstrate the decryption action on one string. One function is \"void decrypt (char str [],int str_length);\" and it can decrypt the string by decreasing the ASCII code of every letter by 5 (eg \'F\' is encrypted to \'A\' ). Use your main function to decrypt the string of \" N2Zxj2H\".

Solution

#include<stdio.h>
#include<conio.h>
#include<string.h>
void decrypt(char * str)
{
   puts(str);
   char * dec;

   int len= strlen(str);
   for(int i=0;i<len;i++)
   {

   int as= str[i];
   printf(\"%d \\t %c\",as,as);
   printf(\"\ \");
   if((as>=100)||(as<=122)||(as>=68)||(as<=90))
   {
       as= as-3;
       dec[i]=char(as);
   }
   if(int(str[i])==97)
   {
   as = str[i];
   as= as+23;
       dec[i]=char(as);
   }
   if(int(str[i])==98)
   {
       as = str[i];
   as= as+23;
       dec[i]=char(as);
   }
   if(int(str[i])==99)
   {
       as = str[i];
   as= as+23;
       dec[i]=char(as);
   }
   if(int(str[i])==67)
   {
   as = str[i];
   as= as+23;
       dec[i]=char(as);
   }
   if(int(str[i])==66)
   {
   as = str[i];
   as= as+23;
       dec[i]=char(as);
   }
   if(int(str[i])==65)
   {
   as = str[i];
   as= as+23;
       dec[i]=char(as);

   }
   if(((str[i])==\'0\')||((str[i])==\'1\')||((str[i])==\'2\')||((str[i])==\'3\')||((str[i])==\'4\')||((str[i])==\'5\')||((str[i])==\'6\')||((str[i])==\'7\')||((str[i])==\' \')||((str[i])==\'8\')||((str[i])==\'9\'))
   {
   dec[i]=str[i];
   }

   }
   puts(dec);
}
int main()
{
char * a;
char ch;
//clrscr();
printf(\"Enter The Input String\ \");
gets(a);
decrypt(a);
return 0;
//getch();
}

this code is runing please write me if you have any problem regrading the solution..

Thank you................

USING C LANGUAGE Write one function to demonstrate the decryption action on one string. One function is \
USING C LANGUAGE Write one function to demonstrate the decryption action on one string. One function is \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site