我正在尝试制作一个锻炼计划,每次开始时都会选择随机锻炼和肌肉群.选择了肌肉群,我遇到了麻烦.
我希望它选择三个阵列中的一个但是现在dice_roll的值总是等于2.不确定我哪里出错了.谢谢你的帮助.
(OBS!请原谅我丑陋的代码,它似乎没有正确发布,所以可能会受到伤害!)
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 …Run Code Online (Sandbox Code Playgroud) c++ ×1