所以这是我的原始代码:
#include <iostream>
using namespace std;
int main ()
{
float x;
cout << "Please enter an integer value: ";
cin >> x;
if ((x >= 100) && (x < 200)) {
cout << "split";
} else if (x == 0 ||x == 1 ) {
cout << "steal";
} else {
cout << "split";
}
system("pause");
}
它工作得很好,但我需要它以这种方式运行:
C:\> program.exe 109
它将读取109
并给出输出 - "steal"
。
C:\> program.exe 0.5
它会读取0.5
并给我输出"split"
。
我必须在原始代码中添加什么才能做到这一点?