- #include <iostream.h>
- #include <stdio.h>
- #include <conio.c>
-
-
- /*############################################################################*/
-
-
- int crypt()
- {
- char mot[999];
- char crypt[999];
- int cle;
-
- clrscr();
-
- cout << "mot a crypter : ";
- gets(mot);
- cout << "cle numerique : ";
- cin >> cle;
-
- for(int n=0;n<strlen(mot);n++)
- {
- crypt[n] = mot[n] ^ cle;
- }
-
- cout << crypt;
- }
-
-
- /*############################################################################*/
-
-
- int decrypt()
- {
- char motc[999];
- char decrypt[999];
- int cle2;
-
- clrscr();
-
- cout << "mot : ";
- gets(motc);
- cout << "cle numerique : ";
- cin >> cle2;
-
- for(int n=0;n<strlen(motc);n++)
- {
- decrypt[n] = motc[n] ^ cle2;
- }
-
- cout << decrypt;
- }
-
- /*############################################################################*/
-
-
- int main()
- {
- int choix;
-
- cout << "1.Crypter\n2.Decrypter\n";
- cin >> choix;
-
- switch(choix)
- {
- case 1:
- crypt();
- break;
-
- case 2:
- decrypt();
- break;
-
- default:
- exit(0);
- break;
- }
-
- getchar();
- }
-
#include <iostream.h>
#include <stdio.h>
#include <conio.c>
/*############################################################################*/
int crypt()
{
char mot[999];
char crypt[999];
int cle;
clrscr();
cout << "mot a crypter : ";
gets(mot);
cout << "cle numerique : ";
cin >> cle;
for(int n=0;n<strlen(mot);n++)
{
crypt[n] = mot[n] ^ cle;
}
cout << crypt;
}
/*############################################################################*/
int decrypt()
{
char motc[999];
char decrypt[999];
int cle2;
clrscr();
cout << "mot : ";
gets(motc);
cout << "cle numerique : ";
cin >> cle2;
for(int n=0;n<strlen(motc);n++)
{
decrypt[n] = motc[n] ^ cle2;
}
cout << decrypt;
}
/*############################################################################*/
int main()
{
int choix;
cout << "1.Crypter\n2.Decrypter\n";
cin >> choix;
switch(choix)
{
case 1:
crypt();
break;
case 2:
decrypt();
break;
default:
exit(0);
break;
}
getchar();
}