Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

) : Detective Download detective.c here Or , copy these file ( s ) to your CSE account using the following command: $ 1 5

):
Detective
Download detective.c here
Or, copy these file(s) to your CSE account using the following command:
$1511 fetch-activity detective
Your mission (if you choose to accept it) is to complete the program
to decipher encoded messages.
Over the past few months UNSW Security Society has found seemingly normal messages paired with random numbers.
To help you solve this challenge we have created the program detective. c that reads in the message and numbers,
storing them in a struct array.
We have been lucky enough to find one decoded message:
Encoded Message: muahahaha_we're_so_evil#_GNTY
Secret Numbers: 7-23-3-6-13-22-24-2-16-4-14-18-20-11-9-28-21-1-27-8-0-26-12-5-10-15-25-19-17
Deciphered Message: haha_we_are_TeasiNG_You
Our observations from this are:
Messages seem to end with a
There are always the same number of letters as there are numbers.
Letters maintain their case between their encoded and deciphered message.
Each number is unique counting from 0 to n-1(where n is the number of letters).
We wish you luck detective!
HINT:
By using the first secret number as an index into the encoded message we find the first letter of the secret
message. I wonder if this pattern can continue? Writing out each number and its associated letter may assist
in solving the cypher.
Examples Assumptions/Restrictions/Clarifications
The maximum number of characters is 100.
The number of characters in the encrypted message and the amount of secret numbers are the same.
The case of each letter is preserved in translation.
Messages will end with a
// Detective
// detective.c
//
// This program was written by YOUR-NAME-HERE (z5555555)
// on INSERT-DATE-HERE
//
// A program to decipher hidden messages in enemy codes.
#include
#define MAX_SIZE 100
struct code {
char letter;
int number;
};
int main(void){
//////////////// DO NOT CHANGE ANY OF THE CODE BELOW HERE //////////////////
struct code message[MAX_SIZE];
// read in message
printf("Please enter Encrypted Message: ");
int i =0;
char letter;
scanf("%c", &letter);
while (letter !='
'){
message[i].letter = letter;
scanf("%c", &letter);
i++;
}
// read in numbers
printf("Please enter Secret Numbers: ");
int j =0;
int number;
scanf("%d", &number);
message[j].number = number;
j++;
while (j != i){
scanf("-%d", &number);
message[j].number = number;
j++;
}
//////////////// DO NOT CHANGE ANY OF THE CODE ABOVE HERE //////////////////
////////////////////////////////////////////////////////////////////////////
///////////////////// ONLY WRITE CODE BELOW HERE ///////////////////////////
////////////////////////////////////////////////////////////////////////////
// TODO: Use the message array to reveal the secret message!
////////////////////////////////////////////////////////////////////////////
///////////////////// ONLY WRITE CODE ABOVE HERE ///////////////////////////
////////////////////////////////////////////////////////////////////////////
return 0;
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions