title: Caesar Cipher in C Encryption & Decryption, ASCII values too high
body: <p>I am working on an encryption/decryption code for C.
  Whilst I have the code encrypting and decrypting well enough there are still some errors.
  I want the users input to be in between '!' (ASCII value 32) and '~' (ASCII value 126), However, when the user puts in a character such as '~' with a fairly highly offset/key-value the output is in the extended ASCII characters range. Is there any way that I can force the output to not be in the extended character range and still decrypt/encrypt properly?</p>
  
  <p>I have messed around with changing the values for "cipher" but it hasn't helped too much.</p>
  
  <p>Below is my code</p>
  
  <pre><code>    void Encryption(char* OriginalText, int offset) {
      int i = 0;
      int cipher;
      char encrypt;
      printf("Encrypted string: \n");
      while (OriginalText[i] != '\0') {
          if (OriginalText[i] == ' ') {
              encrypt = ' ';
              printf("%c", encrypt);
              i = i + 1;
          }
  
          cipher = ((int)OriginalText[i] + (offset % 26) % -26);
          encrypt = (char)(cipher);
          printf("%c", encrypt);
  
          i = i + 1;
      }
      printf("\n");
  }
  </code></pre>