@
olsarets
IMO there is no real need to use classes for this simple code. And you have used terrible names for everything, so this is just confusion for the OP.
@
ianS
Welcome to cplusplus :+)
First up, can we ask you to always use code tags:
I know there is a problem with the code tag button not working when one makes a new post, but one can edit the post afterwards, or manually put the code tags in to start with.
There are many advantages for us if you do this, some are that we get line numbers, and we can compile your code right here with cpp.sh - a small gear icon appears which allows anyone to do this.
So with your code, you need to do several things:
Call the functions from main(), at the moment nothing happens.
1 2 3 4 5 6 7 8 9 10
|
int main() {
unsigned int AgeInYears = 0; // unsigned type is important, avoid negative values
unsigned int HeightInCentimetres = 0; // could use double here if in metres
get_values(AgeInYears, HeightInCentimetres);
// do something with values
return 0;
}
|
Pass some arguments to the function as reference:
1 2 3 4 5 6 7 8 9
|
// pass by reference, the values of these will change in main()
void get_values(unsigned int& AgeInYears, unsigned int& HeightInCentimetres)
{
// int age, height; /// not needed any more
// your code
// nothing to be returned
}
|
You could also do some validation for the values, that could be in it's own function. Validation is a very important idea in coding: it should always be in your mind. Some of the biggest problems in coding comes from either not initialising variables, or the data not being valid.
There is a tutorial, reference material and articles at he top left of this page.
Good Luck, don't hesitate to ask questions :+)