Program to change a character by an asterisk to a string [closed]

-1

Hello! I need to make a program that reads a string entered by the user with a maximum of 500 characters, and print this text by replacing the first letter of each word with an asterisk '*'.

Can anyone help me?

    
asked by anonymous 23.09.2015 / 01:41

1 answer

1

Assuming you are using C

void subs(char *str)
{
   str[0] = '*';
   int size = strlen(str);
   for(int i = 1; i < size; i++)
      if(str[i - 1] == ' ')
         str[i] = '*'
}

// Dentro da main vc le normal e chama a funcao
subs(string);
    
23.09.2015 / 02:34