#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结尾
void put_out_the_first_line(int num);//输出每段(第num段)文本的第一句
//这将是这个程序的最终版本,打工告成,终于可以休息了,1:50了
int main(int argc,char **argv)
{
int i,j;
for(i=2;i<13;i++)
{
put_out_the_first_line(i);
for(j=2+1;j<i+1;j++)
ECodingByNum(-27+j,'/');
ECodingByNum(-27+2,'/');
}
return 0;
}
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);
}
void put_out_the_first_line(int num)
{
ECodingByNum(0,'/');//输出 On the
ECodingByNum(1-num,'/');//输出 first 或者 second 或者 ....
ECodingByNum(-13,'/');//输出 day of Christmas my true love gave to me
}
/*原文
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.
*/