10進数と2進数の基数システムを変換する関数を書いていましたが、元のコードは次のとおりです。
void binary(int number)
{
vector<int> binary;
while (number == true)
{
binary.insert(binary.begin(), (number % 2) ? 1 : 0);
number /= 2;
}
for (int access = 0; access < binary.size(); access++)
cout << binary[access];
}
しかし、私がこれを行うまでは機能しませんでした:
while(number)
どうしたの
while(number == true)
そして、2つの形式の違いは何ですか?前もって感謝します。