您的位置首页百科知识

C语言简单密码破解(密文转明文)

C语言简单密码破解(密文转明文)

的有关信息介绍如下:

C语言简单密码破解(密文转明文)

调了半天,楼主真是太粗心了!middle1[]应该这样声明:char middle1[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','如基态X','Y','Z'};最后输出start的时候要注意控制长度,改个锋春for循环就好了!#include#includeint main(void){ int i,j,length,n; char temp; char middle2[27]; char start[201],finish[201]; char middle1[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; gets(middle2); gets(finish); scanf("%d",&n); length=strlen(finish); for(i=0;i<25;i++) { for(j=i+1;j<26;j++) { if(middle2[i]>渣源middle2[j]) { temp=middle2[i]; middle2[i]=middle2[j]; middle2[j]=temp; temp=middle1[i]; middle1[i]=middle1[j]; middle1[j]=temp; } } } for(i=1;i<=n;i++) { for(j=0;j