Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- int main()
- {
- FILE *test = NULL;
- char leki[10][20] = {0};
- int i = 0;
- int recepta = 0, nierecepta = 0;
- test=fopen("leki.txt", "r+t");
- for (i = 0; i < 10; i++)
- {
- fscanf(test, "%s", &leki[i]);
- printf("Czy %s jest na recepte (T,N)\n", leki[i]);
- if(getche()=='t')
- {
- recepta++;
- }
- else
- nierecepta++;
- }
- printf("%d na recepte, %d darmowych\n", recepta, nierecepta);
- getch();
- fclose(test);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment