一段经典的c 分析8

#include <stdio.h>

//密码
#define PASSWORD "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:/nuwloca-O;m .vpbks,fxntdCeghiry"
//密文
#define CODE "@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l+,/n{n+,/+#n+,/#/;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l /q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# /){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' /iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c /;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')# /}'+}##(!!/"

void ECodingChar(int n);//将一个字符解码
void ECodingWord(char *a,char end);//将一个字符串解码,end是结束字符串的字符
void ECodingByNum(int num,char end);//解码密文中第num个字符串字符串以end结尾

main(int t,int n,char *a)
{
///  1
 if(t == 1)
 {
  main(2,2,"任何字符都行");
 }
///  2
///用于输出每一行的第一句
///如On the first day of Christmas my true love gave to me
///  On the second day of Christmas my true love gave to me
/// .......
 if(t == 2)
 {
  ECodingByNum(0,'/');//输出 On the
  ECodingByNum(1-n,'/');//输出 first 或者 second 或者 ....
  ECodingByNum(-13,'/');//输出 day of Christmas my true love gave to me
 }
//  1 -- +无穷大
 if(1<t)
 {
  if(t<n)
   main(t+1,n,a);
  ECodingByNum(-27+t,'/');
  if(t == 2 && n<13)
   main(2,n+1,"任何字符都行");
 }
}

void ECodingChar(int n)
{
 int i=0;
 char *b = PASSWORD;
 while(1)
 {
  if(n==b[i])
  {
   putchar(b[i+31]);
   break;
  }
  i++;
 }
}
void ECodingWord(char *a,char end)
{
 char * b = a;
 while(*b != end)
 {
  ECodingChar(*b);
  b++;
 }
}
void ECodingByNum(int num,char end)
{
 int i = num;
 char * a= CODE;
 while(i<0)
 {
  if(*a == end) i++;
  a++;
 };
 ECodingWord(a,end);
}
/*原文
On the first day of Christmas my true love gave to me
a partridge in a pear tree.

On the second day of Christmas my true love gave to me
two turtle doves
and a partridge in a pear tree.

On the third day of Christmas my true love gave to me
three french hens, two turtle doves
and a partridge in a pear tree.

On the fourth day of Christmas my true love gave to me
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the fifth day of Christmas my true love gave to me
five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the sixth day of Christmas my true love gave to me
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the seventh day of Christmas my true love gave to me
seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the eigth day of Christmas my true love gave to me
eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the ninth day of Christmas my true love gave to me
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the tenth day of Christmas my true love gave to me
ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the eleventh day of Christmas my true love gave to me
eleven pipers piping, ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

On the twelfth day of Christmas my true love gave to me
twelve drummers drumming, eleven pipers piping, ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.

*/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值