Advertisement
Guest User

Program

a guest
Mar 24th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.10 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5.  
  6. void menu(){
  7.   printf("\n%s\n%s\n%s\n%s\n%s\n%s",
  8.     "======================================================",
  9.     "Klawisze:",
  10.     "1 -> wczytaj i wypisz",
  11.     "2 -> wczytaj, zaszyfruj i wypisz",
  12.     "0 -> wyjdz",
  13.     "======================================================"
  14.   );
  15. }
  16.  
  17. char *cezar(char *wiadomosc){
  18.  
  19.   return wiadomosc;
  20. }
  21.  
  22. int main(void)
  23. {
  24.  
  25.   int znak;
  26.   char sms[180];
  27.  
  28.   while(true){
  29.     menu();
  30.  
  31.     printf("\n%s", "Podaj opcje: ");
  32.     scanf("%d", &znak);
  33.     printf("\n");
  34.  
  35.     switch(znak){
  36.       case 1:
  37.         fgetc(stdin);
  38.         printf("\nPodaj wiadomosc: ");
  39.         fgets(sms, 180, stdin);
  40.         printf("\nTwoja wiadomosc: %s", sms);
  41.         break;
  42.  
  43.       case 2:
  44.         fgetc(stdin);
  45.         printf("\nPodaj wiadomosc: ");
  46.         fgets(sms, 180, stdin);
  47.         printf("\nTwoja zaszyfrowana wiadomosc: %s", cezar(sms));
  48.         break;
  49.  
  50.       case 0:
  51.       default:
  52.         printf("%s", "Wyszedles!");
  53.         return EXIT_SUCCESS;
  54.     }
  55.   }
  56.  
  57.   return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement