/** * capitalize-1.c * * David J. Malan * malan@harvard.edu * * Capitalizes a given string. * * Demonstrates islower and toupper. */ #include #include #include #include int main(void) { // get line of text string s = GetString(); // capitalize text for (int i = 0, n = strlen(s); i < n; i++) { if (islower(s[i])) { printf("%c", toupper(s[i])); } else { printf("%c", s[i]); } } printf("\n"); }