📄 rollsum.cpp
字号:
#include <iostream>using namespace std;#include "dice.h"#include "prompt.h"// simulate rolling two dice to obtain specified sum// Owen Astrachan, 8/9/94int main(){ Dice d1(6); // define two dice Dice d2(6); int numRolls = 1; // # of times dice are rolled int targetSum = PromptRange("enter target to roll:",2,12); while (d1.Roll() + d2.Roll() != targetSum) { numRolls += 1; } cout << "number of rolls needed to get " << targetSum << " = " << numRolls << endl; return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -