Advertisement
jhon345

Untitled

Sep 27th, 2014
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. typedef struct cliente{
  5. char nome[50];
  6. int tipo;
  7. float area;
  8. float saldo;
  9.  
  10. }Cliente;
  11. int quantidade_cliente = 0;
  12. Cliente *fazendeiro;
  13. void menu(){
  14. printf("\n 1- cadastrar ");
  15. printf("\n 2- exibir");
  16. printf("\n 3- calcular debito");
  17. printf("\n 0- sair ");
  18. }
  19. void cadastrar(char *nome,int type,float acre){
  20.  
  21. strcpy(fazendeiro[quantidade_cliente].nome,nome);
  22. fazendeiro[quantidade_cliente].tipo = type;
  23. fazendeiro[quantidade_cliente].area = acre;
  24. quantidade_cliente++;
  25.  
  26. }
  27. void exibir(){
  28. int i;
  29. for(i=0;i<quantidade_cliente;i++){
  30. printf("%s",fazendeiro[quantidade_cliente].nome);
  31. printf("%d",fazendeiro[quantidade_cliente].tipo);
  32. printf("%f",fazendeiro[quantidade_cliente].area);
  33. }
  34. }
  35. void calc_debito(int quant){
  36.  
  37.  
  38. if((fazendeiro[quant].tipo ==1)&&(fazendeiro[quant].area<=1000)){
  39. fazendeiro[qant].saldo = 500*fazendeiro[quant].area;
  40. if(fazendeiro[quant].saldo > 75000){
  41. fazendeiro[quant].saldo = fazendeiro[quant].saldo *0,90;
  42.  
  43. }
  44.  
  45. }
  46.  
  47. quant ++;
  48. }
  49. void execultar_operacao(int opicao){
  50.  
  51. char nome[50];
  52. int type;
  53. float acre;
  54.  
  55. switch(opicao){
  56. case 1:
  57. printf("Informe o nome :");
  58. fflush(stdin);
  59. scanf("%s",nome);
  60. printf("Informe o tipo de puverização :");
  61. fflush(stdin);
  62. scanf("%d",&type);
  63. printf("Informe a area em acre :");
  64. fflush(stdin);
  65. scanf("%f",&acre);
  66. cadastrar(nome,type,acre);
  67. break;
  68. case 2 :
  69. exibir();
  70. break;
  71. case 3 :
  72.  
  73.  
  74. }
  75. }
  76.  
  77.  
  78.  
  79. int main(){
  80. int opicao;
  81. menu();
  82.  
  83. do{
  84. printf("Digite uma opição");
  85. scanf("%d",&opicao);
  86. execultar_operacao(opicao);
  87. }while(opicao!=0);
  88.  
  89. return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement