Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdio.h>
- #include <ctype.h>
- int fix_name(char nome[])
- {
- printf("digite o nome a ser consertado: \n");
- fgets(nome, 150, stdin);
- nome[strlen(nome)-1] = '\0';
- char c = ' ';
- for(int i=0;i<strlen(nome);i++)
- {
- if(islower(nome[0]))
- {
- nome[0] = toupper(nome[0]);
- }
- else if(nome[i]==c)
- {
- nome[i+1] = toupper(nome[i+1]);
- }
- }
- //printf("%s", nome);
- puts(nome);
- return 0;
- }
- int main(void)
- {
- char name[100];
- fix_name(name);
- return 0;
- }
Add Comment
Please, Sign In to add comment