I want to write a simple c++ code that will calculate some data for me. Since I'm new with c++ and I want to work with constructors to learn how they work, I have a problem and don't know how to solve it.
When I run the code, I get the number 1.79154e-307 which is probably the size of the integer. For the begining I simply want to display the number I handle the function setPro. (In this case it's 10)Code:#include <iostream> using namespace std; class calc { public: double setPro (double pro ); double getPro( void ); calc(); // This is the constructor private: double prozent; }; // Member functions definitions including constructor calc::calc(void) { cout << "Object is being created" << endl; } double calc::setPro( double pro ) { pro = prozent; cout<<prozent; } double calc::getPro( void ) { return prozent; } // Main function for the program int main() { calc quanten; quanten.setPro(10); return 0; }
Thanks for your help!