零与非零
判断一个逻辑量是否为真时,采取的标准是:如果其值是0就认为是“假”的,如果其值是非0就认为是真的
例:
#include <iostream>
using namespace std;
int main()
{
int x = 3;
do
{
x = x - 2;
cout << x;
} while (!(--x));
return 0;
}
零与非零
判断一个逻辑量是否为真时,采取的标准是:如果其值是0就认为是“假”的,如果其值是非0就认为是真的
例:
#include <iostream>
using namespace std;
int main()
{
int x = 3;
do
{
x = x - 2;
cout << x;
} while (!(--x));
return 0;
}