im making a function to calculate stats for a text rpg i am making(this is just part of the actual game). i input the numbers and when i display the numbers i inputted in the call it gives me some really big numbers that i dont know is. i want to use the numbers that the function returns for other calculations during the game.
#include <iostream>
usingnamespace std;
int StatCalcW(int str, int stam)
{
int ptsleft = 50;
while(ptsleft > 0)
{
cout << "Select your stats - 50 total points for strength and stamina" << endl;
cout << "Points in strength: ";
cin >> str;
ptsleft = ptsleft - str;
cout << "Select points in stamina (Hint - everypoint in stamina is 2 hp): ";
cin >> stam;
ptsleft = ptsleft - stam;
}
cout << "You have picked:" << endl;
cout << str << " Points in strength." << endl;
cout << stam << " Points in stamina." << endl;
return str, stam;
}
int main()
{
int PlayerStrength, PlayerStamina;
StatCalcW(PlayerStrength, PlayerStamina);
cout << PlayerStrength << endl;
cout << PlayerStamina << endl;
return 0;
}
say i enter 20 for strength and 30 for stamina then it will give me:
4585658145 and 569879565 when i check to see the what playerstrength and playerstamina is.