Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void imprimir();
- struct dados{
- char nome[35];
- char sexo[23];
- char estadocivil[15];
- char rg[30];
- char cpf[20];
- char datanasci[20];
- char nacionalidade[35];
- char naturalidade[35];
- char uf[2];
- char endereco[40];
- int numerocasa;
- char complemento[40];
- char municipio[40];
- char bairro[35];
- char cep[10];
- char telefone[35];
- char celular[35];
- char email[35];
- char datacada[35];
- };
- struct dados *pontdados ;
- int x=0,n=0,opcao=0;
- void cadastrar(){
- do{
- if(x==1){
- n=n+1;
- }
- if(opcao==1){
- n=n+1;
- }
- pontdados = (struct dados*) malloc(sizeof(struct dados));
- printf("Digite nome completo:\n");
- fflush(stdin);
- gets(pontdados[n].nome);
- printf("Informe seu sexo:\n");
- fflush(stdin);
- gets(pontdados[n].sexo);
- printf("Informe Est.Civil:\n");
- fflush(stdin);
- gets(pontdados[n].estadocivil);
- printf("Informe RG:\n");
- fflush(stdin);
- gets(pontdados[n].rg);
- printf("Informe CPF:\n");
- fflush(stdin);
- gets(pontdados[n].cpf);
- printf("Informe Data de nascimento::\n");
- fflush(stdin);
- gets(pontdados[n].datanasci);
- printf("Informe Nacionalidade:\n");
- fflush(stdin);
- gets(pontdados[n].nacionalidade);
- printf("Informe Naturalidade:\n");
- fflush(stdin);
- gets(pontdados[n].naturalidade);
- printf("Informe UF:\n");
- fflush(stdin);
- gets(pontdados[n].uf);
- printf("Informe Endereco:\n");
- fflush(stdin);
- gets(pontdados[n].endereco);
- printf("Informe Numero:\n");
- fflush(stdin);
- scanf("%d",&pontdados[n].numerocasa);
- printf("Informe Complemento:\n");
- fflush(stdin);
- gets(pontdados[n].complemento);
- printf("Informe Municipio:\n");
- fflush(stdin);
- gets(pontdados[n].municipio);
- printf("Informe Bairro:\n");
- fflush(stdin);
- gets(pontdados[n].bairro);
- printf("Informe CEP:\n");
- fflush(stdin);
- gets(pontdados[n].cep);
- printf("Informe Telefone:\n");
- fflush(stdin);
- gets(pontdados[n].telefone);
- printf("Informe Celular:\n");
- fflush(stdin);
- gets(pontdados[n].celular);
- printf("Informe E-mail:\n");
- fflush(stdin);
- gets(pontdados[n].email);
- printf("Informe Data de Cadastro:\n");
- fflush(stdin);
- gets(pontdados[n].datacada);
- printf("Deseja cadastrar outro cliente?1-Sim/2-Nao\n");
- scanf("%d",&x);
- system("cls");
- }while(x==1);
- }
- void imprimir(){
- int i;
- for(i=0;i<=n;i++){
- printf("\n------------CADASTRO DO CLIENTE------------\n\n");
- printf("Nome: %s\n", pontdados[n].nome);
- printf("Sexo: %s\n", pontdados[n].sexo);
- printf("Estado civil: %s\n", pontdados[n].estadocivil);
- printf("RG: %s\n", pontdados[n].rg);
- printf("CPF: %s\n", pontdados[n].cpf);
- printf("Data de nascimento: %s\n", pontdados[n].datanasci);
- printf("Nascionalidade: %s\n", pontdados[n].nacionalidade);
- printf("Naturalidade: %s\n", pontdados[n].naturalidade);
- printf("UF: %s", pontdados[n].uf);
- printf("Endereco: %s\n", pontdados[n].endereco);
- printf("Numero da casa: %d\n", pontdados[n].numerocasa);
- printf("Complemento: %s\n", pontdados[n].complemento);
- printf("Municipio: %s\n", pontdados[n].municipio);
- printf("Bairro: %s\n", pontdados[n].bairro);
- printf("CEP: %s\n", pontdados[n].cep);
- printf("Telefone: %s\n", pontdados[n].telefone);
- printf("Celular: %s\n", pontdados[n].celular);
- printf("Email: %s\n", pontdados[n].email);
- printf("Data de cadastro: %s\n", pontdados[n].datacada);
- }
- }
- void menu(){
- do{
- printf("*******************************\n");
- printf("|\t1 - Cadastrar |\n");
- printf("|\t2 - Imprimir |\n");
- printf("|\t3 - Sair |\n");
- printf("*******************************\n");
- printf("Informe uma opcao:");
- scanf("%d", &opcao);
- switch(opcao){
- case 1:
- cadastrar();
- break;
- case 2:
- system("cls");
- imprimir();
- break;
- case 3:
- sair();
- break;
- default :
- printf("Opcao invalida!");
- break;
- }
- }while(opcao != 3);
- }
- void sair(){
- exit(0);
- }
- void main(){
- menu();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement