#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
#define tam 50
int apenas_letras(char *texto){
int i;
for (i = 0; texto[i] != '\0'; ++i){
if (!isalpha(texto
[i
]) && texto
[i
] != ' '){ return 0;
}
}
return 1;
}
int main(){
struct cadastro{
char nome[tam];
};
struct cadastro dados;
fgets(dados.
nome,tam
,stdin
);
size_t tam_nome
= strlen(dados.
nome); if (dados.nome[tam_nome - 1] == '\n'){
dados.nome[tam_nome - 1] = '\0';
}
if(apenas_letras(dados.nome) == 1){ //verificar se são letras
printf("Nome: %s\n",dados.
nome); //converter para letra maiuscula }else{
printf("Insira somente letras.\n"); }
return (0);
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3RkbGliLmg+CiNpbmNsdWRlPGN0eXBlLmg+CiNpbmNsdWRlPHN0cmluZy5oPgojZGVmaW5lIHRhbSA1MAoKaW50IGFwZW5hc19sZXRyYXMoY2hhciAqdGV4dG8pewogICAgaW50IGk7CiAgICBmb3IgKGkgPSAwOyB0ZXh0b1tpXSAhPSAnXDAnOyArK2kpewogICAgICAgIGlmICghaXNhbHBoYSh0ZXh0b1tpXSkgJiYgdGV4dG9baV0gIT0gJyAnKXsKICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIDE7Cn0KCgppbnQgbWFpbigpewogICAgc3RydWN0IGNhZGFzdHJvewogICAgICAgIGNoYXIgbm9tZVt0YW1dOwogICAgfTsKICAgIHN0cnVjdCBjYWRhc3RybyBkYWRvczsKCiAgICBwcmludGYoIk5vbWU6Iik7CiAgICBmZ2V0cyhkYWRvcy5ub21lLHRhbSxzdGRpbik7CgogICAgc2l6ZV90IHRhbV9ub21lID0gc3RybGVuKGRhZG9zLm5vbWUpOwogICAgaWYgKGRhZG9zLm5vbWVbdGFtX25vbWUgLSAxXSA9PSAnXG4nKXsKICAgICAgICBkYWRvcy5ub21lW3RhbV9ub21lIC0gMV0gPSAnXDAnOwogICAgfQoKICAgIGlmKGFwZW5hc19sZXRyYXMoZGFkb3Mubm9tZSkgPT0gMSl7ICAvL3ZlcmlmaWNhciBzZSBzw6NvIGxldHJhcwogICAgICAgIHByaW50ZigiTm9tZTogJXNcbiIsZGFkb3Mubm9tZSk7ICAvL2NvbnZlcnRlciBwYXJhIGxldHJhIG1haXVzY3VsYQogICAgfWVsc2V7CiAgICAgICAgcHJpbnRmKCJJbnNpcmEgc29tZW50ZSBsZXRyYXMuXG4iKTsKICAgIH0KCiAgICByZXR1cm4gKDApOwp9Cg==