Skip to main content
1 of 2

pset2 initials problem

don't understand why it show error

:) initials.c exists :) initials.c compiles :( outputs "MB" for "Milo Banana" \ expected prompt for input, not output of "Input you name\n" :( outputs "MB" for "milo banana" \ expected prompt for input, not output of "Input you name\n" :( outputs "RTB" for "Robert Thomas Bowden" \ expected prompt for input, not output of "Input you name\n" :( outputs "R" for "ROB" \ expected prompt for input, not output of "Input you name\n" :( outputs "RTB" for "Robert thomas Bowden"

string s = GetString();

printf("%c", toupper(s[0]));

for (int i = 1, n = strlen(s); i < n; i++)
{
   if (s[i] == ' ')
   {
     printf("%c", toupper(s[i+1]));
   }
}