Home > Back-end >  Caesar Cipher C program not printing
Caesar Cipher C program not printing

Time:10-02

Basically what the title says. Can anyone tell me why my program won't print at the end? As far as I can tell the for loop should be rotating each letter but at this point, I have no idea.

#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>

int main(void)
{

    int key; 
    bool keyValid = false;

    while (keyValid == false)
    {
        printf("Enter rotation key: ");
        scanf("%d", &key);

        if (key >= 0 && key <= 26)
        {
            keyValid = true;
        }
        else
        {
            printf("Error - key must be in range 0 and 26. Try again. ");
        }
    }

    // printf("Encrypting message (key = %d): %s \n", key, message);

    
    

    if(keyValid == true) {

        char message[80]; 
        printf("Enter message to encrypt: ");
        scanf("            
  • Related