Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main.cpp
- #include <cstdlib>
- #include <iostream>
- #include "termometro.h"
- using namespace std;
- int main(int argc, char *argv[])
- {
- c.temperatura;
- printf("%f\n", c.temperatura);
- c.esfriar();
- printf("%f\n", c.temperatura);
- c.aquecer();
- printf("%f\n", c.temperatura);
- system("PAUSE");
- return EXIT_SUCCESS;
- }
- -------------------------------------------------------------------
- .h
- // Class automatically generated by Dev-C++ New Class wizard
- #ifndef TERMOMETRO_H
- #define TERMOMETRO_H
- #include <iostream>
- using namespace std;
- /*
- * No description
- */
- class temperatura
- {
- public:
- // class constructor
- temperatura(string tipoTemperatura);
- temperatura(string tipoTemperatura,float temperaturaAtual);
- // class destructor
- ~temperatura();
- float temperaturaAtual;
- string tipo;
- void aquecer(float temperaturaAtual);
- void esfriar(float temperaturaAtual);
- };
- #endif // TERMOMETRO_H
- --------------------------------------------------------------------------
- .cpp
- // Class automatically generated by Dev-C++ New Class wizard
- #include"termometro.h" // class's header file
- #include<stdio.h>
- #include<stdlib.h>
- #include<iostream>
- using namespace std;
- // class constructor
- termometro::termometro(string tipoTemperatura)
- {
- temperatura = tipo;
- // insert your code here
- }
- // class destructor
- termometro::~termometro(string tipoTemperatura,float valorTemperatura)
- {
- temperatura = tipo;
- valor = temperatura;
- // insert your code here
- }
- void temperatura :: aquecer(float valorTemperatura) {
- temperatura = temperatura + 5;
- }
- void temperatura :: esfriar(float valorTemperatura){
- temperatura = temperatura - 4;
- }
Add Comment
Please, Sign In to add comment