Advertisement
Guest User

Nic

a guest
Oct 24th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     FILE *soubor;
  7.     char znak;
  8.  
  9.     soubor = fopen("znaky.txt", "r");
  10.  
  11.     while ((znak = fgetc(soubor)) != EOF)
  12.     {
  13.         if (znak == 'q') {
  14.             printf("Nasel jsem znak q, koncim.");
  15.             return 0;
  16.         } else
  17.         {
  18.             switch (znak)
  19.             {
  20.             case '0':
  21.                 printf("Nasel jsem nulu.\n");
  22.                 break;
  23.             case '1':
  24.                 printf("Nasel jsem jednicku.\n");
  25.                 break;
  26.             }
  27.         }
  28.     }
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement