Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char arrA[5][5] = {'a', 'f', 'k', 'p', 'w',
- 'b', 'g', 'l', 'r', 'x',
- 'c', 'h', 'm', 's', 'y',
- 'd', 'i', 'n', 't', 'z',
- 'e', 'j', 'o', 'u', ' '};
- char *arrB[100] = { NULL }; // tablica wskaznikow do arrA
- char tekst[100]; //wczytywany tekst
- int i, j, k;
- printf("Podaj tekst majacy niewiecej niz 100 znakow.\nTekst: ");
- fgets (tekst, 100, stdin);
- for (k = 0; k < 100 ; k++)
- {
- for (i = 0; i < 5; i++)
- {
- for (j = 0; j < 5; j++)
- {
- if(tekst[k] == arrA[i][j])
- {
- arrB[k] = &arrA[i][j];
- }
- }
- }
- if(tekst[k] == '\n')
- break;
- }
- printf("\n");
- //wypisanie tekstu przez tablice wskaznikow arrB
- for (i = 0; i < 101 && arrB[i] != '\0' ; i++)
- {
- printf("%c", arrB[i]);
- }
- printf("\nKoniec programu.\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment