Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #define individual 2
  5. #define coletivo 2
  6.  
  7. struct apartamento{
  8.  
  9. int num,carro;
  10. float custoI;
  11. };
  12.  
  13. struct predio{
  14.  
  15. struct apartamento ap[individual];
  16. int aguaP,luzP,salP,custoP;
  17.  
  18. };
  19.  
  20. struct condominio{
  21.  
  22. struct predio bl[coletivo];
  23. float aguaC,luzC,salC,Acomum,custoC;
  24. };
  25.  
  26. void cadastrarCC(struct condominio *valorC){
  27. int i;
  28.  
  29.  
  30. printf("INFORME O VALOR DA AGUA DO CONDOMINIO: ");
  31. scanf("%f", &valorC[i].aguaC);
  32.  
  33. printf("INFORME O VALOR DA LUZ DO CONDOMINIO: ");
  34. scanf("%f", &valorC[i].luzC);
  35.  
  36. printf("INFORME O VALOR DO SALARIO DOS FUNCIONARIOS DO CONDOMINIO: ");
  37. scanf("%f", &valorC[i].salC);
  38.  
  39. printf("INFORME O VALOR DOS CUSTOS DA AREA COMUM DO CONDOMINIO: "); //comum inclui todas as despesas geradas pelas àreas coletivas do condomínio (exceto água, luz e salários)
  40. scanf("%f", &valorC[i].Acomum);
  41.  
  42.  
  43. }
  44.  
  45. void cadastrarCP(struct predio *valorP){
  46. int i;
  47.  
  48. for(i=0; i<coletivo; i++){
  49.  
  50. printf("INFORME O VALOR DA AGUA DO PREDIO %i: ",i+1);
  51. scanf("%f", &valorP[i].aguaP);
  52.  
  53. printf("INFORME O VALOR DA LUZ DO PREDIO %i: " ,i+1);
  54. scanf("%f", &valorP[i].luzP);
  55.  
  56. printf("INFORME O VALOR DO SALARIO DOS FUNCIONARIOS DO PREDIO %i: " ,i+1);
  57. scanf("%f", &valorP[i].salP);
  58.  
  59. }
  60. }
  61. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  62.  
  63. /*void mostrar(struct condominio *valorC){
  64. int i;
  65.  
  66. printf("O VALOR DA AGUA DO CONDOMINIO eh: %.2f \n",valorC[i].aguaC);
  67.  
  68. }*/
  69. int main(int argc, char *argv[]) {
  70.  
  71. struct condominio riopedras[coletivo];
  72. struct predio bloco[coletivo];
  73. system("COLOR F0");
  74. cadastrarCC(&riopedras);
  75. system("cls");
  76. cadastrarCP(&bloco);
  77.  
  78. //system("cls");
  79. //mostrar(riopedras);
  80. return 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement