对于我当前的项目,我创建了一个事件,该事件应该根据我的代码生成的随机整数而改变,唯一的问题是我似乎总是得到相同的路径.总之,我希望它发生任何事件的几率为50%.谢谢,西蒙
random1 = rand() % 1 + 0;
if (random1 == 0) {
int choice4;
cout << "Your character screams at the top of his lungs, " << endl;
cout << "this causes the dragon to immediately to bow in fear..." << endl;
cout << "It turns out dragons are very sensitive to hearing....." << endl;
system("pause");
cout << "\nIt seems the dragon is requesting you ride it!\n" << endl;
cout << "Will you ride it?\n" << endl;
cout << …Run Code Online (Sandbox Code Playgroud)