0% found this document useful (0 votes)
15 views

My Version - New

The document contains code for a program that will encipher or decipher a 4 character message by shifting each character by a user-input number. It includes functions to process each character, determine the ciphering, and a main function to get user input and call the determine_ciphering function.

Uploaded by

lanelowes594
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

My Version - New

The document contains code for a program that will encipher or decipher a 4 character message by shifting each character by a user-input number. It includes functions to process each character, determine the ciphering, and a main function to get user input and call the determine_ciphering function.

Uploaded by

lanelowes594
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <stdio.

h>

//input

//process info

char process_info(letter_in, encipher, number_in)


{
if(letter_in >= 'a' && letter_in <= 'z')

//output

//main body

void determine_ciphering(char letter1, char letter2, char letter3, char letter4)


{
char encipher;
int num1, num2, num3, num4;
char output1, output2, output3, output4;

printf("would you like to encipher or decipher this message (e/d)? ");


scanf(" %c", &encipher);

if(encipher == 'e')
{
printf("Enter numbers to encipher by: ");
}
else
{
printf("Enter numbers to decipher by: ");
}
scanf("%d %d %d %d", &num1, &num2, &num3, &num4);

print("%c %c %c %c", &output1, &output2, &output3, &output4);


}

///////////////////////////////////////////////////////////////////////////////
///////////////////// DO NOT EDIT THIS MAIN FUNCTION ///////////////////////////
////////////////////////////////////////////////////////////////////////////////
// This main function scans a message and then calls your determine_ciphering
// procedure, passing in the message.
int main(void) {
// Have a think about how we might implement this with a `struct message`
// once we've covered structs in the Thursday lecture!
char letter1;
char letter2;
char letter3;
char letter4;
// Scan message into the four characters
printf("Message: ");
scanf (
"%c %c %c %c",
&letter1, &letter2, &letter3, &letter4
);
// Call your determine_ciphering function and pass in the message.
determine_ciphering(letter1, letter2, letter3, letter4);
}

You might also like