Hi, I'm currently writing a poker game and am trying my best to avoid using global variables. I have a few variables in int main() which i was hoping to use to store the value of each players hand. I then created a function which calculates the value of the hand but cannot get this value back into the main function.
For example:
Is there any way i can get the value of value using this function?Code:#include <iostream> using namespace std; void getValue(int value) { value = 4; } int main() { int value; getValue(value); cout <<"the value is: " <<value; }
If not what do you suggest i do?
Thanks