最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

寒假刷题之2Decoder

来源:动视网 责编:小采 时间:2020-11-09 15:41:09
文档

寒假刷题之2Decoder

寒假刷题之2Decoder:附上原题: The Decoder Write a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of ch
推荐度:
导读寒假刷题之2Decoder:附上原题: The Decoder Write a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of ch


附上原题: The Decoder Write a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of characters and print the exact message that the characters


附上原题:

The Decoder

Write a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of characters and print the exact message that the characters contain. The code key for this simple coding is a one for one character substitution based upon asingle arithmetic manipulation of the printable portion of the ASCII character set.

Input and Output

For example: with the input file that contains:

1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu5
1PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu5
1KLJ'pz'{ol'{yhklthyr'vm'{ol'Kpnp{hs'Lx|pwtlu{'Jvywvyh{pvu5

your program should print the message:

*CDC is the trademark of the Control Data Corporation.
*IBM is a trademark of the International Business Machine Corporation.
*DEC is the trademark of the Digital Equipment Corporation.

Your program should accept all sets of characters that use the same encoding scheme and should print the actual message of each set of characters.

Sample Input

1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu5
1PIT'pz'h'{yhklthyr'vm'{ol'Pu{lyuh{pvuhs'I|zpulzz'Thjopul'Jvywvyh{pvu5
1KLJ'pz'{ol'{yhklthyr'vm'{ol'Kpnp{hs'Lx|pwtlu{'Jvywvyh{pvu5

Sample Output

*CDC is the trademark of the Control Data Corporation.
*IBM is a trademark of the International Business Machine Corporation.
*DEC is the trademark of the Digital Equipment Corporation.
 太遗憾了,我刚才搜上一题看看网上有没有人也做了这一题时,翻到了连在后面的这一题。。我已经看了攻略了。。
 虽然没看到代码,但这跟抄袭没两样,我怀着愧疚把代码写出来了。。
#include

int main()
{
	char code;
	
	for (; (code = getchar()) != EOF; ){
	if (code == '\n')
	printf("\n");
	else
	printf("%c", code + ('*' - '1'));
	}
	return 0;
}

 好吧,顺利ac了,本来看到什么读取文件什么的我还以为是文件操作,看来不需要了。

文档

寒假刷题之2Decoder

寒假刷题之2Decoder:附上原题: The Decoder Write a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a simple coded set of ch
推荐度:
标签: the 寒假 上原
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top