#include #include #include "stringy.h" int meno() { char str[11]; char strkopia[25]; printf("Zadaj meno(max 10 znakov):"); scanf("%10s", str); strcpy(strkopia, str); char *acko = strchr(str, 'a'); int polohaAcka = -1; if (acko) { polohaAcka = acko - str; } strcat(strkopia, " je tvoje meno"); int dlzka = strlen(str); printf("Kópia: %s, meno: %s ,dĺžka: %d, 'a' sa nachádza na: %d mieste v zadanom texte", strkopia, str, dlzka, polohaAcka); } int stringy() { char word[21]; char *p; char tried[100]; char *triedptr = tried; printf("Zadaj slovo(max 20 znakov):"); fgets(word, 20, stdin); int unknownCharacterExists = 1; while (unknownCharacterExists) { printf("Zadaj znak:"); char znak = '\n'; while (znak == '\n'){ znak = getchar(); } *triedptr = znak; triedptr++; p = word; int characterFound; unknownCharacterExists = 0; while (*p != '\n') { characterFound = 0; for (char *triedFindptr = tried; *triedFindptr != 0; triedFindptr++) { if (*p == *triedFindptr) { putchar(*p); characterFound = 1; break; } } if (!characterFound) { putchar('_'); unknownCharacterExists = 1; } p++; } putchar('\n'); } return 0; }