I am trying to make a workout program that selects a random workout and musclegroup every time you start it. I have had difficulty choosing which muscular group he chooses.
I would like for him to select one of the three arrays, but right now the dice_roll value is always equal to 2. Not sure where I made a mistake. Thanks for any help.
(OBS! Sorry my ugly code, it doesn't seem to be published correctly so that it can be evaluated!)
int main()
{
int muscleGroup;
string chest[2] = {"Benchpress 4x2", "Pushups 10x4"};
string legs[2] = {"Squat 8x4", "Leg extension 10x3"};
string back[2] = {"Pullup 3x8", "Rows 10x3"};
mt19937 generator;
uniform_int_distribution<int> distribution(0, 2);
int dice_roll = distribution(generator);
if (dice_roll == 0)
{
cout << "You are training: Chest" << endl;
cout << "Your exercises are going to be written below!" << endl;
}
else if (dice_roll == 1)
{
cout << "You are training: Legs" << endl;
cout << "Your exercises are going to be written below!" << endl;
}
else if (dice_roll == 2)
{
cout << "You are training: Back" << endl;
cout << "Your exercises are going to be written below!" << endl;
}
return 0;
}
source
share