3 thích 0 k thích
965 đã xem

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) - đã hỏi trong Chapter 2: Syntax structure of the C language bởi (5.9k điểm)
ID: 26955 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn

đã sửa bởi | 965 đã xem

22 Trả lời

0 thích 0 k thích
Hidden content!
#include<stdio.h>

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

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

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

** *** * ** * * * * ** *** **** * *** ** * *
* ** *** * *** * ** * 0;
}
100/100 trả lời bởi (244 điểm)
0 0
Case 0: Correct output
Case 1: Wrong output
0 thích 0 k thích
Hidden content!
#include ** ****** **
int main(int argc, char *argv[]) {


* **** * ** char a;
* * ** * * * ** ** * * b;
** * *** **** * * * * * c;
** * ** ** ** * * ** ** d;
****** **** ** * ** * e;
* ** * * * ** *** * **
* * * * ** *** ** ** * * ** * * ** ** * ** ** * * * ** *
* *** *****
* * *** * * the message how??
* * * *
* ** * * ***** * ** *** * ***** ** * ** *** **
*** ** * ***
* ** * * * return 0;
}
100/100 trả lời bởi (221 điểm)
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 thích 0 k thích
Hidden content!
int main(int argc, char *argv[]) {


* *** *   char a;
* * ** ** ** *** b;
*** * *** *** char c;
*** * * * * * * d;
* * * * * * * * * * e;
** ***** ** ***** ** ****** * * **** *  
    * *** * * %c %c %c %c **** **** * ** * * ** * ** **
** ** *  
    * ** * ** ** ** ** ** ** * *** * ** * * *** ***** *** ***** *
** ***** ** * * **
*** **   * * * * * * *** *
** * * ** * *** *
** * ** *** **** * * ** * * *
* * ***** * * ***** ***
* * ** ** ** * *** * **** * * *** *** **
** * * ** * * * ***
***** **** * * 0;
}
50/100 trả lời bởi (244 điểm)
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 thích 0 k thích
Hidden content!
*** ****** * **

* *** * ** * {

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

e = * *
* =
* = *
= *

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

** * * ** **** * * ** *
100/100 trả lời bởi (183 điểm)
0 0
Case 0: Correct output
Case 1: Wrong output
0 thích 0 k thích
Hidden content!
** * * * * *

* ** * * * * * * * {

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

e =
* = *
* = **
=

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

* * * ***** * ** ** * **
**
100/100 trả lời
0 0
Case 0: Correct output
Case 1: Wrong output
0 thích 0 k thích
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 trả lời bởi (243 điểm)
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 thích 0 k thích
Hidden content!
** * **** ** ***

int **** * argc, char ** {


** ** * ** * char a;
* * * *** * *** ** ** ** *** * *** char b;
***** * * * * ** ** * ***
** * * * *** **** ** * ***** * ** ***
* *** ***
* * * ** * *** * the * * how??
*** ** * *****
** * * ** ** * ** ***** * * a,b);
* * **
* * * * ** ** * 0;
}
50/100 trả lời
0 0
Case 0: Wrong output
Case 1: Wrong output
0 thích 0 k thích
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 trả lời bởi (220 điểm)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 thích 0 k thích
Hidden content!
* *** * ** **

** * ** * * **** {

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

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

****** * ** ** ** ** *
*
100/100 trả lời bởi (283 điểm)
đã sửa bởi
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 thích 0 k thích
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 trả lời bởi (220 điểm)
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:172.70.100.115
©2016-2024

Những câu hỏi liên quan

0 thích 0 k thích
2 trả lời
[Normal] Essay (Open question) - đã hỏi ngày 12 tháng 12 năm 2017 trong Chapter 2: Syntax structure of the C language bởi 許哲瑋 (449 điểm)
ID: 37081 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 160 đã xem
12,783 câu hỏi
183,443 trả lời
172,219 bình luận
4,824 thành viên