Advertisement
Karim_Gabr

Untitled

Jun 24th, 2014
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7.     printf("\t\t\tWelcome to ASCII converter\n");
  8.     printf("\t\t\t--------------------------\n");
  9.     int operation;
  10.     char encrypt_char;
  11.     int decrypt_char;
  12.  
  13.     while(1)
  14.     {
  15.         printf("\n\nSelect Encryption/Decryption\n\nPress 1 for Encryption - Press 2 for Decryption : ");
  16.         scanf("%d",&operation);
  17.         scanf("%*c");
  18.  
  19.         if(operation == 1)
  20.         {
  21.             printf("\nEnter String : ");
  22.             while(1)
  23.             {
  24.                 scanf("%c",&encrypt_char);
  25.                 if(encrypt_char == 10) break;
  26.                 printf("%d ",encrypt_char);
  27.             }
  28.         }
  29.  
  30.         else if(operation == 2)
  31.         {
  32.             printf("\nEnter String (Enter 0 to submit) : ");
  33.             while(1)
  34.             {
  35.                 scanf("%d",&decrypt_char);
  36.                 if(decrypt_char == 0) break;
  37.                 printf("%c",decrypt_char);
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement