Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char *argv[])
- {
- int i, j, odp;
- FILE *p;
- printf("wybierz: 1 zapis\t2 odczyt\n");
- scanf("%d", &odp);
- char liczby[3][20];
- char litera[20];
- switch (odp)
- {
- case 1:
- p=fopen("znaki.txt","w");
- for(i=65,j=1; i<=90; i++, j++)
- {
- fprintf(p,"%d\t%c", i,i);
- if(j%3==0)
- fprintf(p,"\n");
- else
- fprintf(p,"\t\t");
- }
- fprintf(p,"\n\n\t\t\tMALE LITERY\n");
- for(i=97,j=1; i<=122; i++, j++)
- {
- fprintf(p,"%d\t%c", i,i);
- if(j%3==0)
- fprintf(p,"\n");
- else
- fprintf(p,"\t\t");
- }
- fprintf(p,"\n");
- fclose(p);
- break;
- case 2:
- {
- char t[80];
- p=fopen("znaki.txt","r");
- while( !feof(p))
- {
- fgets(t,80,p);
- if (t[0]==' ' || t[0]=='\t' || t[0] == '\n')
- continue;
- int a, b, c;
- char v1, v2, v3;
- sscanf(t, "%d %c %d %c %d %c", &a, &v1, &b, &v2, &c, &v3);
- printf("%d %d %d %c %c %c\n", a, b, c, v1, v2, v3);
- }
- fclose(p);
- break;
- }
- default: printf("ERROR\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment