基本上做一个密码生成器。想过滤掉ASCII字符91-96 这里是我的if语句。我怎样才能缩短它使它像 “randomnumber == 91-96”而不必重复自己?如何缩短||代码在if语句中C++
if (randomnum == 91 || randomnum == 92 || randomnum == 93 || randomnum == 94 || randomnum == 95 || randomnum == 96) // We dont want values 91 - 96
{ // Do nothing
}
'if(randumnum> = 91 && randomnum <= 96)' –
就像酷家伙说的那样,退后一步,抽象出条件,然后用C表达它。如果你想让数字成为大于“a”**和**小于“b”,你就是这么写的。 – StoryTeller
感谢:)工作 – IVIaximumPower