一段经典的c 分析10

该博客展示了一个用C语言编写的密文解码程序。程序中定义了密码和密文,包含多个解码函数,如将字符、字符串解码等。通过主函数调用这些函数,最终实现对密文的解码,输出特定格式的文本内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


#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.

*/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值