Vincent38190

TPE Experience 3 v2 FIX en cour

Jan 18th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <math.h>
  5. #include "algorithme.h"
  6. #define TAILLE_MAX 1000
  7. //algorithme.c : http://pastebin.com/d2c7RCNZ
  8. //algorithme.h : http://pastebin.com/jKBSFgx8
  9.  
  10.  
  11. int main(int argc, char *argv[])
  12. {
  13.     srand(time(NULL));
  14.     while(1)
  15.     {
  16.         char messagesNonCrypte[TAILLE_MAX] = "", messagesCrypte[TAILLE_MAX] = "";
  17.         int cle = 0, choix = 0;
  18.         printf("\nChoix 1 : Chiffrement\nChoix 2 : Dechiffrement\nChoix 3 : Montrer ancien message\nChoix 4 : Quitter\nVotre choix ? \n");
  19.         scanf("%d", &choix);
  20.         if(choix == 1) //Chiffrement
  21.         {
  22.             printf("Quelle est le message ? (utiliser \"_\" pour les espaces)\nMessage : ");
  23.             scanf("%s",messagesNonCrypte);
  24.             printf("Quelle est la cle ?\nCle : ");
  25.             scanf("%d",&cle);
  26.             Chiffrement(messagesNonCrypte,messagesCrypte,cle);
  27.             Save(messagesNonCrypte,messagesCrypte,cle);
  28.             printf("Le message crypte est : %s",messagesCrypte);
  29.         }
  30.         else if(choix == 2) //Dechiffrement
  31.         {
  32.              printf("Quelle est le message ? (utiliser \"_\" pour les espaces)\nMessage : ");
  33.             scanf("%s",messagesCrypte);
  34.             printf("Quelle est la cle ?\nCle : ");
  35.             scanf("%d",&cle);
  36.             Dechiffrement(messagesCrypte,messagesNonCrypte,cle);
  37.             Save(messagesNonCrypte,messagesCrypte,cle);
  38.             printf("Le message decrypte est : %s",messagesNonCrypte);
  39.         }
  40.         else if(choix == 3) //SAVE
  41.         {
  42.             AfficherSave();
  43.         }
  44.         else if(choix == 4) //EXIT
  45.         {
  46.             goto FIN;
  47.         }
  48.         else
  49.         {
  50.             printf("Erreur mauvais choix\n");
  51.         }
  52.  
  53.     }
  54.     FIN:
  55.     return 0;
  56. }
Add Comment
Please, Sign In to add comment