Guest User

Untitled

a guest
Jan 23rd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. main.cpp
  2.  
  3. #include <cstdlib>
  4. #include <iostream>
  5. #include "termometro.h"
  6.  
  7. using namespace std;
  8.  
  9. int main(int argc, char *argv[])
  10. {
  11. c.temperatura;
  12.  
  13.  
  14.  
  15. printf("%f\n", c.temperatura);
  16. c.esfriar();
  17.  
  18. printf("%f\n", c.temperatura);
  19. c.aquecer();
  20.  
  21.  
  22.  
  23. printf("%f\n", c.temperatura);
  24.  
  25. system("PAUSE");
  26. return EXIT_SUCCESS;
  27. }
  28. -------------------------------------------------------------------
  29. .h
  30.  
  31. // Class automatically generated by Dev-C++ New Class wizard
  32.  
  33. #ifndef TERMOMETRO_H
  34. #define TERMOMETRO_H
  35. #include <iostream>
  36.  
  37. using namespace std;
  38. /*
  39. * No description
  40. */
  41. class temperatura
  42. {
  43. public:
  44. // class constructor
  45.  
  46.  
  47. temperatura(string tipoTemperatura);
  48. temperatura(string tipoTemperatura,float temperaturaAtual);
  49.  
  50.  
  51. // class destructor
  52.  
  53. ~temperatura();
  54. float temperaturaAtual;
  55.  
  56. string tipo;
  57.  
  58.  
  59. void aquecer(float temperaturaAtual);
  60. void esfriar(float temperaturaAtual);
  61.  
  62.  
  63. };
  64. #endif // TERMOMETRO_H
  65. --------------------------------------------------------------------------
  66.  
  67. .cpp
  68.  
  69. // Class automatically generated by Dev-C++ New Class wizard
  70.  
  71. #include"termometro.h" // class's header file
  72. #include<stdio.h>
  73. #include<stdlib.h>
  74. #include<iostream>
  75.  
  76. using namespace std;
  77.  
  78.  
  79. // class constructor
  80. termometro::termometro(string tipoTemperatura)
  81. {
  82.  
  83. temperatura = tipo;
  84.  
  85. // insert your code here
  86. }
  87.  
  88. // class destructor
  89. termometro::~termometro(string tipoTemperatura,float valorTemperatura)
  90. {
  91.  
  92. temperatura = tipo;
  93. valor = temperatura;
  94.  
  95.  
  96. // insert your code here
  97. }
  98.  
  99.  
  100. void temperatura :: aquecer(float valorTemperatura) {
  101. temperatura = temperatura + 5;
  102. }
  103.  
  104. void temperatura :: esfriar(float valorTemperatura){
  105. temperatura = temperatura - 4;
  106. }
Add Comment
Please, Sign In to add comment