1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
| #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
void main()
{
int i,j,k,x,n,ligne,l[256],trouve,ligne1,z;
char r[5],t[256][256],t1[256][256],cle,cle1,ch[256],ch1[256],mot[200],ab,ch2[5];
i=0;
j=0;
printf("DONNE LE TEXTE A CRYPTE \n"); //REMPLISSAGE DU TABLEAU DE CARACTERES//
printf("*******************************************************************\n");
do //
{ //
j=0;
printf("* \t\t"); //
gets(ch); //
l[i]= strlen(ch);
for(k=0;k<(int)strlen(ch);k++) //
{ //
t[i][j]=ch[k]; //
j++ ; //
} //
i++; //
n=strlen(ch); //
}while(ch[n-1]!= '#'); //
ligne1=i;
ligne=ligne1;
x=0;
trouve=0;
printf("donner la chaine a recherche"); //
gets(mot);
do{
x++;
for(i=0;i<(ligne-1);i++)
{
for(j=0;j<l[i];j++)
{
if(t[i][j]<='Z' && t[i][j]>='A')
{
if((t[i][j]-x)>=65)
t1[i][j]=t[i][j]-x;
else
t1[i][j]=(t[i][j]-x)+26;
}
else
if(t[i][j]<='z' && t[i][j]>='a')
{
if((t[i][j]-x)>=97)
t1[i][j]=t[i][j]-x;
else
t1[i][j]=(t[i][j]-x)+26;
}
}
}
for(i=0;i<(ligne1-1);i++)
{
strcpy(ch1,"");
getch();
printf("-1-");
for(j=0;j<l[i];j++)
{
printf("-2-");
getch();
strcpy(*ch2,t1[i][j]); //-------ERREUR-----------------------
printf("-3- %s",ch2);
strcat(&ch1,&ch2);
printf("-4-");
if(strcmp(ch,mot)==0)
trouve=1;
}
}
}while((x<25) && (trouve==0));
printf("4");
for(i=0;i<(ligne1-1);i++)
{
for(j=0;j<l[i];j++)
{printf("%c",t[i][j]);}
printf("\n");
}
for(i=0;i<(ligne1-1);i++)
{
for(j=0;j<l[i];j++)
{printf("%c",t1[i][j]);}
printf("\n");
}
getch();
} |
Partager