Advertisement
Guest User

upgrade

a guest
Apr 25th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void imprimir();
  5.  
  6. struct dados{
  7. char nome[35];
  8. char sexo[23];
  9. char estadocivil[15];
  10. char rg[30];
  11. char cpf[20];
  12. char datanasci[20];
  13. char nacionalidade[35];
  14. char naturalidade[35];
  15. char uf[2];
  16. char endereco[40];
  17. int numerocasa;
  18. char complemento[40];
  19. char municipio[40];
  20. char bairro[35];
  21. char cep[10];
  22. char telefone[35];
  23. char celular[35];
  24. char email[35];
  25. char datacada[35];
  26. };
  27.  
  28.  
  29. struct dados *pontdados ;
  30. int x=0,n=0,opcao=0;
  31.  
  32. void cadastrar(){
  33. do{
  34. if(x==1){
  35. n=n+1;
  36. }
  37. if(opcao==1){
  38. n=n+1;
  39. }
  40. pontdados = (struct dados*) malloc(sizeof(struct dados));
  41.  
  42. printf("Digite nome completo:\n");
  43. fflush(stdin);
  44. gets(pontdados[n].nome);
  45.  
  46. printf("Informe seu sexo:\n");
  47. fflush(stdin);
  48. gets(pontdados[n].sexo);
  49.  
  50. printf("Informe Est.Civil:\n");
  51. fflush(stdin);
  52. gets(pontdados[n].estadocivil);
  53.  
  54. printf("Informe RG:\n");
  55. fflush(stdin);
  56. gets(pontdados[n].rg);
  57.  
  58. printf("Informe CPF:\n");
  59. fflush(stdin);
  60. gets(pontdados[n].cpf);
  61.  
  62. printf("Informe Data de nascimento::\n");
  63. fflush(stdin);
  64. gets(pontdados[n].datanasci);
  65.  
  66. printf("Informe Nacionalidade:\n");
  67. fflush(stdin);
  68. gets(pontdados[n].nacionalidade);
  69.  
  70. printf("Informe Naturalidade:\n");
  71. fflush(stdin);
  72. gets(pontdados[n].naturalidade);
  73.  
  74. printf("Informe UF:\n");
  75. fflush(stdin);
  76. gets(pontdados[n].uf);
  77.  
  78. printf("Informe Endereco:\n");
  79. fflush(stdin);
  80. gets(pontdados[n].endereco);
  81.  
  82. printf("Informe Numero:\n");
  83. fflush(stdin);
  84. scanf("%d",&pontdados[n].numerocasa);
  85.  
  86. printf("Informe Complemento:\n");
  87. fflush(stdin);
  88. gets(pontdados[n].complemento);
  89.  
  90. printf("Informe Municipio:\n");
  91. fflush(stdin);
  92. gets(pontdados[n].municipio);
  93.  
  94. printf("Informe Bairro:\n");
  95. fflush(stdin);
  96. gets(pontdados[n].bairro);
  97.  
  98. printf("Informe CEP:\n");
  99. fflush(stdin);
  100. gets(pontdados[n].cep);
  101.  
  102. printf("Informe Telefone:\n");
  103. fflush(stdin);
  104. gets(pontdados[n].telefone);
  105.  
  106. printf("Informe Celular:\n");
  107. fflush(stdin);
  108. gets(pontdados[n].celular);
  109.  
  110. printf("Informe E-mail:\n");
  111. fflush(stdin);
  112. gets(pontdados[n].email);
  113.  
  114. printf("Informe Data de Cadastro:\n");
  115. fflush(stdin);
  116. gets(pontdados[n].datacada);
  117.  
  118. printf("Deseja cadastrar outro cliente?1-Sim/2-Nao\n");
  119. scanf("%d",&x);
  120. system("cls");
  121. }while(x==1);
  122. }
  123. void imprimir(){
  124. int i;
  125. for(i=0;i<=n;i++){
  126. printf("\n------------CADASTRO DO CLIENTE------------\n\n");
  127. printf("Nome: %s\n", pontdados[n].nome);
  128. printf("Sexo: %s\n", pontdados[n].sexo);
  129. printf("Estado civil: %s\n", pontdados[n].estadocivil);
  130. printf("RG: %s\n", pontdados[n].rg);
  131. printf("CPF: %s\n", pontdados[n].cpf);
  132. printf("Data de nascimento: %s\n", pontdados[n].datanasci);
  133. printf("Nascionalidade: %s\n", pontdados[n].nacionalidade);
  134. printf("Naturalidade: %s\n", pontdados[n].naturalidade);
  135. printf("UF: %s", pontdados[n].uf);
  136. printf("Endereco: %s\n", pontdados[n].endereco);
  137. printf("Numero da casa: %d\n", pontdados[n].numerocasa);
  138. printf("Complemento: %s\n", pontdados[n].complemento);
  139. printf("Municipio: %s\n", pontdados[n].municipio);
  140. printf("Bairro: %s\n", pontdados[n].bairro);
  141. printf("CEP: %s\n", pontdados[n].cep);
  142. printf("Telefone: %s\n", pontdados[n].telefone);
  143. printf("Celular: %s\n", pontdados[n].celular);
  144. printf("Email: %s\n", pontdados[n].email);
  145. printf("Data de cadastro: %s\n", pontdados[n].datacada);
  146.  
  147. }
  148. }
  149. void menu(){
  150.  
  151.  
  152. do{
  153.  
  154. printf("*******************************\n");
  155. printf("|\t1 - Cadastrar |\n");
  156. printf("|\t2 - Imprimir |\n");
  157. printf("|\t3 - Sair |\n");
  158. printf("*******************************\n");
  159.  
  160.  
  161. printf("Informe uma opcao:");
  162. scanf("%d", &opcao);
  163.  
  164. switch(opcao){
  165. case 1:
  166. cadastrar();
  167.  
  168. break;
  169. case 2:
  170. system("cls");
  171. imprimir();
  172. break;
  173. case 3:
  174. sair();
  175.  
  176. break;
  177. default :
  178. printf("Opcao invalida!");
  179. break;
  180.  
  181. }
  182. }while(opcao != 3);
  183. }
  184.  
  185. void sair(){
  186.  
  187. exit(0);
  188.  
  189. }
  190.  
  191.  
  192. void main(){
  193. menu();
  194. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement