3 like 0 dislike
952 views

You have received an encrypted message from Julius Caesar-- the message is ebiil.  You are asked to decipher the message in order to understand what Caesar trying to say to you.

Hint

Luckily, Caesar has given you a hint, he says: 'I, myself, encoded the message by shifting every word backwards by 3.' 

Solution

Write a program that receives 5 characters 'ebiil'. Then decode those characters into 5 new characters.

Example

#include <stdio.h>

int main(int argc, char *argv[]) {


	char a;
    	char b;
	 	
	scanf("%c%c", &a, &b);
	
	//decode the message how??
	
	printf("%c%c", a,b);
	
	return 0;
}

Input

ebiil

 

 

 

 

 

 

 

 

 

 

Output

hello

** REMEMBER ** 
This is an online-compiler, don't put anything except the codes. If you want to make a comment, please use // or /* */

[Exercise] Coding (C) - asked in Chapter 2: Syntax structure of the C language by (5.9k points)
ID: 26955 - Available when: Unlimited - Due to: Unlimited

edited by | 952 views

22 Answers

1 like 0 dislike
Hidden content!
* * * * ** ** *
#include ** * **
int main(int argc, char *argv[]) {
** * * * ** * * lettera;
*** ****** ** * ** ** ** letterz;
* ** * * **** ** * * * letterx;
** ** ***** ***** * *** letterc;
* ** *** ** * ** **** * *** letterv;
** ** *
*** *** * ** ** * * **** input the letter to encode: ");
* ** * * ******* * *** ** ** * * **** ** * * ** * ** * **** ** * * *** ** * * ** * **
*** **** ****** * * ** * * * = lettera + 3;
*** * ** ****** * *** * * = letterz + 3;
**** * ***** * *** *** ***** = letterx + 3;
* ***** * ** ** ** **** *** = letterc + 3;
* ** ****** * **** = letterv + 3;
* ** * *** ***
** ***** * * ** ** * ****** ** * ** * ** ** * * ** * * * **
** *** * ****
** ** *** *** ***** **** ** ** 0;
}
50/100 answered by (269 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Nice, it is correct. You might be wondering why your automatically-generated score is 0.
That's because it expects its output to be only 'hello'. However, what your program showed was:
     Please input the letter to encode: ebiil
     hello

Anyway, great job. Full marks.
0 like 0 dislike
Hidden content!
* * ** ** *** * * *
* * ** * *** * ***

int * * * * argc, char * * * {
***** char * **
** * * * * * * *
***** * ** ** a = ***
** * **** b = * **
*** ** ** c = **
**** ** * d = * * *
* ** ****** e = ** *
*****
* * * *** ** a += 3;
* * * * * * b += 3;
**** * * ** * * c += 3;
* * *** * d += 3;
**** ** ** e += 3;

* * ** **** * * ** **
* * ** * * *
*** * * * * ** *
**** *** * ** *
** * ** * * *
* ** * * * *
**** * ** **
* *** * * *
* ** *** * * ** ** 0;
}
answered by (5.9k points)
0 0
Case 0: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.178.169
©2016-2024

Related questions

0 like 0 dislike
2 answers
[Normal] Essay (Open question) - asked Dec 12, 2017 in Chapter 2: Syntax structure of the C language by 許哲瑋 (449 points)
ID: 37081 - Available when: Unlimited - Due to: Unlimited
| 156 views
12,783 questions
183,443 answers
172,219 comments
4,824 users