3 like 0 dislike
10k 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 | 10k views

22 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>

int main (int argc,char *argv)
{
    char a;
* *** ** **** * * * * * b;
* * *** *** ** ** * *** * c;
* * * ** **** * d;
** * * ** ** * ** * e;

** ** * * ******** * * * ** * ** **** **** * *** * * ** *** *** ** *** *

* **** * *** *** *** ** **
* * * * **** * * *
*** ** * ** **** ** ** * * * * **
**** ** * ** * *
* ** * * * * * * ** ** *

**** * **** ** ** * * * * **** ** * ***
** * ******* ** *** ** 0;
}
100/100 answered by (244 points)
0 0
Case 0: Correct output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include * *** * ***
int main(int argc, char *argv[]) {


* **** ** * ** * char a;
* ** * * * * * * *** * * b;
*** ** ** *** ** c;
** *** ****** * * * ** d;
* * ** ** ** ** ** * **** * e;
* * ** * *** *** * * * * * *
* ** * *** * * * * *** ** * *** ***** * ** * * * **** *
** * *****
** ** ** * ** * * * the message how??
** * *
* * * * ***** * ** *** * * ** ** * *** * ** *
* * *****
* * * ** return 0;
}
100/100 answered by (221 points)
0 0
prog.c: In function 'main':
prog.c:10:2: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
  scanf("%c%c%c%c%c", &a, &b, &c, &d, &e);
  ^~~~~
prog.c:10:2: warning: incompatible implicit declaration of built-in function 'scanf'
prog.c:10:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
prog.c:14:2: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
  printf("%c%c%c%c%c", a+3,b+3,c+3,d+3,e+3);
  ^~~~~~
prog.c:14:2: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:14:2: note: include '<stdio.h>' or provide a declaration of 'printf'
0 0
Case 0: Correct output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
int main(int argc, char *argv[]) {


*** *   char a;
**** * * ** *** * * b;
** ** * ******* char c;
*** * ** * ***** *** ** * ** d;
* ** **** *** * * e;
***** *** ** * * * ** ** ** **  
    ** * * * %c %c %c %c * ** * * * ** ** * * ** **** ***
*** **  
    * ** * * * * * * * ** ** * * * * * *** *** * ***** * * *
** * * *** * * ***** *
***   * * **** *
* **** **** *** *** *
* *** * * ** *** ***
** * * ** * *** * * **
*** ** ** ** * * ** *** * ** **** *
*** *** * ** ***
* *** ** 0;
}
50/100 answered by (244 points)
0 0
prog.c: In function 'main':
prog.c:10:2: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
  scanf("%c %c %c %c %c %c", &a, &b,&c, &d,&e);
  ^~~~~
prog.c:10:2: warning: incompatible implicit declaration of built-in function 'scanf'
prog.c:10:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
prog.c:10:25: warning: format '%c' expects a matching 'char *' argument [-Wformat=]
  scanf("%c %c %c %c %c %c", &a, &b,&c, &d,&e);
                         ^
prog.c:12:6: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  if(a="e",b="b",c="i",d="i",e="l")
      ^
prog.c:12:12: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  if(a="e",b="b",c="i",d="i",e="l")
            ^
prog.c:12:18: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  if(a="e",b="b",c="i",d="i",e="l")
                  ^
prog.c:12:24: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  if(a="e",b="b",c="i",d="i",e="l")
                        ^
prog.c:12:30: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  if(a="e",b="b",c="i",d="i",e="l")
                              ^
prog.c:14:2: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
  printf("hello");
  ^~~~~~
prog.c:14:2: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:14:2: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:18:5: warning: incompatible implicit declaration of built-in function 'printf'
     printf("errol");
     ^~~~~~
prog.c:18:5: note: include '<stdio.h>' or provide a declaration of 'printf'
0 like 0 dislike
Hidden content!
* ** * **** **** *

* * ** ** * {

** * *
** = **
= *** **
* = * *
= * *
= * * *

e = * *
= *
= *
* = *

* *
*****
* *
*** *
***** *

** * ** *** * * * ** ** *
**
100/100 answered by (183 points)
0 0
Case 0: Correct output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
* ***** * * *** ****

** * ** ** ** {

* * *
= *
= ** **
= * *
* = **** ***
= ** ***

e = **
* =
= *
* = *

** **
** * *
**** **
*** *
* *

* * **** * **** ***** * *
*
100/100 answered
0 0
Case 0: Correct output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include ****** ********
#include **** * **** * ** *

int main(int argc, char *argv[]) {
* * *** * * ****** * * * letterj;
** * * *** * **** letteri;
* * ** * *** ****** ** letterm;
* **** * * * * ** * * lettere;
*** * ** * **** * **** lettern;
* * *** * ** * ** ***
****** * * * **** * * * ***** ** **** * * input the letter to encode: ");  
* *** * ** * ***** * *
*** ***** *** * ** * ** *** * * * &letterj, ** ** ** *** &letterm, ******* *** ** ******
** * * ** * * ** * ** *** +3;
* ** *** **** *** *** +3;
* ** ** ** * ** *** * * +3;
* * *** ** **** * *** * ******* * +3;
**** * * * * * ***** * * +3;
* * *** **** *** ***
*** * * * * * ** * * **
*** * * * * * ** * ** ***** * * *** *** ** * ** *** * * * lettere, lettern);
** **** ** * ** **** * *
* ** ** **** ** * * ** 0;
}


INPUT
* * ******* *
** * * ** * **
OUTPUT
** ** * * *
100/100 answered by (243 points)
0 0
prog.c:27:1: error: unknown type name 'INPUT'
 INPUT
 ^~~~~
prog.c:30:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'OUTPUT'
 OUTPUT
 ^~~~~~
prog.c:30:1: error: unknown type name 'OUTPUT'
0 like 0 dislike
Hidden content!
* * ***

int ** * argc, char ** * {


**** **** char a;
* * **** ** *** * * * ** * * * * * char b;
* ** ** **** * * ** * *
** ** * * ** * * *** * *** *
* * ** * ** *
** * **** **** the *** how??
*** * * *
** *** ** * * * * ** * * a,b);
* ** * ****
**** * * ** 0;
}
50/100 answered
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include * * * ** *

int main(int argc, char *argv[])
{
* * ** * **** * letterj;
* ** ***** * **** * * letteri;
* ** ********** * * * ** * letterm;
******* **** ** *** * * ** * lettere;
* * ** ** ** *** *** * lettern;
* * ** ******* * **
* * *** *** *** * *** * * input the letter to encode: ** ***** * * ****
* * ** ** * ** * ***** ***** ** ** ** * ** * ** * ** * **** * ** * * * * *
**** * * ** ** **
* **** *** ** * * * * = letterj +3;
** **** * **** ** * * * ** = letteri +3;
*** * * ** ** ** * * * ** = letterm +3;
**** ** * * * * **** * = lettere +3;
** * ** * ** ** ** = lettern +3;
**** **** * *** * ** *
**** * * * ******** ** * *** * * ** * ***** * lettere, lettern);
* ** *** ***** ****

***** *** * ** 0;
}
100/100 answered by (220 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
**** **** * ** *

** ** ** * ** * {

* * **
= ***
** = **
i = * ** *
* = * *
= ****
e =
* = * **
* = **
= ***

* *
* ** **
*** ***
********
* * *

* ** ** ** * *** *
*
100/100 answered by (283 points)
edited by
0 0
prog.c:1:16: fatal error: stdio: No such file or directory
 #include<stdio>
                ^
compilation terminated.
0 0
prog.c: In function 'main':
prog.c:6:5: error: 'cin' undeclared (first use in this function)
     cin >> a;
     ^~~
prog.c:6:5: note: each undeclared identifier is reported only once for each function it appears in
prog.c:11:5: error: 'cout' undeclared (first use in this function)
     cout << a << endl << endl;
     ^~~~
prog.c:11:18: error: 'endl' undeclared (first use in this function)
     cout << a << endl << endl;
                  ^~~~
0 0
prog.c: In function 'main':
prog.c:6:11: warning: too many arguments for format [-Wformat-extra-args]
     scanf("c", &a);
           ^~~
prog.c:11:14: warning: format '%c' expects argument of type 'int', but argument 2 has type 'char *' [-Wformat=]
     printf("%c", a)
              ^
prog.c:12:5: error: expected ';' before 'return'
     return 0;
     ^~~~~~
0 0
prog.c: In function 'main':
prog.c:6:11: warning: too many arguments for format [-Wformat-extra-args]
     scanf("c", &a);
           ^~~
prog.c:11:14: warning: format '%c' expects argument of type 'int', but argument 2 has type 'char (*)[5]' [-Wformat=]
     printf("%c", &a);
              ^
0 0
Case 0: Correct output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include * * * * ****
#include * * * **

int main(int argc, char *argv[]) {
*** ** * * ** *** *** letterj;
* * ** * * *** * * * * letteri;
** *** *** * ** ** * letterm;
** * *** ** * * ** * *** lettere;
** * ** ***** * ** * ******* lettern;
* * *** * * *
* ** * * * * * * **** ** ** input the letter to encode: * * *  
********** ** ** ** *** * *** ** * ** *** ** * **** ***** * * * ***** * ** *** ** **** * **
***** * *** * * *
*** * * * *** letterj = letterj +3;
* * * *** **** ** * ** * = letteri +3;
* **** * ** * * * = letterm +3;
* ** * *** * **** ******** * * * = lettere +3;
** ***** **** * ** * * * = lettern +3;
* * * * * * ** * *** ** *
** ***** * * * *********** * ** * *** *** * * ** * * ** *** *** * lettere, lettern);
* * *** *** ***
* ** * ** ** * ** * * * ***** * 0;
}
100/100 answered by (220 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.159.115.9
©2016-2026

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
| 1.4k views
12,783 questions
183,442 answers
172,219 comments
4,824 users