// Pantea Aria // strings - reading - working on chars one by one // ctype.h library functions // Write a C program that reads a line of characters from the user and // send it to a function, converts all uppercase letters to lowercase. // can you write it for multiple books? until user enters Ctrl-D #include #include #define MAX 30 void my_tolower(char str[]); int main(void) { char book[MAX]; // means book is an empty string now // how can I repeat this? printf("Enter your favourite book: "); while (fgets(book, MAX, stdin) != NULL) { printf("Original: %s", book); // call the function my_tolower(book); printf("Lowercase: %s", book); printf("Enter your favourite book: "); } return 0; } void my_tolower(char str[]) { int i = 0; while(str[i] != '\0' && str[i] != '\n'){ str[i] = tolower(str[i]); i++; } }