#include <stdio.h>
#include <stdlib.h>
#define NOME_TAM_MAX 51
#define ENDERECO_TAM_MAX 101
typedef struct
{
int idCliente;
char nome[ NOME_TAM_MAX] ;
char CPF[ 16 ] ;
char endereco[ ENDERECO_TAM_MAX] ;
} Cliente;
void cadastrarCliente ( void )
{
Cliente
* newCliente
= ( Cliente
* ) malloc ( sizeof ( Cliente
) ) ; if ( ! newCliente)
{
printf ( "ERRO DE MEMORIA!!!\n " ) ; }
else
{
printf ( "\n --- PRENCHA OS DADOS DE CADASTRO DO CLIENTE ---\n \n " ) ; printf ( "Digite o ID do cliente: " ) ; scanf ( "%d" , & newCliente
-> idCliente
) ; printf ( "Digite o nome do cliente: " ) ; scanf ( " %[^\n ]" , newCliente
-> nome
) ; printf ( "Digite o CPF do cliente: " ) ; scanf ( " %s" , newCliente
-> CPF
) ; printf ( "Digite o endereco do cliente: " ) ; scanf ( " %[^\n ]" , newCliente
-> endereco
) ;
printf ( "ID: %d\n Nome: %s\n CPF: %s\n Endereco: %s" , newCliente
-> idCliente
, newCliente
-> nome
, newCliente
-> CPF
, newCliente
-> endereco
) ;
}
return ;
}
int main( ) {
cadastrarCliente( ) ;
return 0 ;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCiNkZWZpbmUgTk9NRV9UQU1fTUFYIDUxCiNkZWZpbmUgRU5ERVJFQ09fVEFNX01BWCAxMDEKCnR5cGVkZWYgc3RydWN0CnsKICAgICAgICBpbnQgaWRDbGllbnRlOwogICAgICAgIGNoYXIgbm9tZVtOT01FX1RBTV9NQVhdOwogICAgICAgIGNoYXIgQ1BGWzE2XTsKICAgICAgICBjaGFyIGVuZGVyZWNvW0VOREVSRUNPX1RBTV9NQVhdOwp9Q2xpZW50ZTsKCnZvaWQgY2FkYXN0cmFyQ2xpZW50ZSAodm9pZCkKewogICAgICAgIENsaWVudGUgKm5ld0NsaWVudGUgPSAoQ2xpZW50ZSAqKSBtYWxsb2Moc2l6ZW9mKENsaWVudGUpKTsKICAgICAgICBpZiAoIW5ld0NsaWVudGUpCiAgICAgICAgewogICAgICAgICAgICAgICAgcHJpbnRmKCJFUlJPIERFIE1FTU9SSUEhISFcbiIpOwogICAgICAgICAgICAgICAgZXhpdCgtMSk7CiAgICAgICAgfQogICAgICAgIGVsc2UKICAgICAgICB7CiAgICAgICAgICAgICAgICBwcmludGYoIlxuLS0tIFBSRU5DSEEgT1MgREFET1MgREUgQ0FEQVNUUk8gRE8gQ0xJRU5URSAtLS1cblxuIik7CiAgICAgICAgICAgICAgICBwcmludGYoIkRpZ2l0ZSBvIElEIGRvIGNsaWVudGU6ICIpOwogICAgICAgICAgICAgICAgc2NhbmYoIiVkIiwgJm5ld0NsaWVudGUtPmlkQ2xpZW50ZSk7CiAgICAgICAgICAgICAgICBwcmludGYoIkRpZ2l0ZSBvIG5vbWUgZG8gY2xpZW50ZTogIik7CiAgICAgICAgICAgICAgICBzY2FuZigiICVbXlxuXSIsIG5ld0NsaWVudGUtPm5vbWUpOwogICAgICAgICAgICAgICAgcHJpbnRmKCJEaWdpdGUgbyBDUEYgZG8gY2xpZW50ZTogIik7CiAgICAgICAgICAgICAgICBzY2FuZigiICVzIiwgbmV3Q2xpZW50ZS0+Q1BGKTsKICAgICAgICAgICAgICAgIHByaW50ZigiRGlnaXRlIG8gZW5kZXJlY28gZG8gY2xpZW50ZTogIik7CiAgICAgICAgICAgICAgICBzY2FuZigiICVbXlxuXSIsIG5ld0NsaWVudGUtPmVuZGVyZWNvKTsKCgogICAgICAgICAgICAgICAgcHJpbnRmKCJJRDogJWRcbk5vbWU6ICVzXG5DUEY6ICVzXG5FbmRlcmVjbzogJXMiLCBuZXdDbGllbnRlLT5pZENsaWVudGUsIG5ld0NsaWVudGUtPm5vbWUsIG5ld0NsaWVudGUtPkNQRiwgbmV3Q2xpZW50ZS0+ZW5kZXJlY28pOwoKICAgICAgICB9CgogICAgICAgIHJldHVybjsKfQoKaW50IG1haW4oKXsKICAgIGNhZGFzdHJhckNsaWVudGUoKTsKICAgIHJldHVybiAwOwp9Cg==