/* Nome: Mario Cognome: Montanari strchr() */ #include #include #define SIZE 100+1 using namespace std; char *strchr(const char *src, int c); int main(void) { char src[SIZE]; char *ptr; int chr = 'a'; cout << "Inserisci una parola o una frase: "; cin.getline(src, SIZE); ptr = strchr(src, chr); if (ptr != nullptr) { cout << "Carattere trovato" << endl; } else { cout << "Character not found!" << endl; } return 0; } char *strchr(const char *src, int c) { do { if (*src == c) { return (char*)src; } } while (*src++); return NULL; }