//缺少花括号界定块
if (ival1 != ival2){
ival1 = ival2;
} else {
ival1 = ival2 = 0;
}
//缺少花括号,默认occurs=1在块外执行
if (ival < minval){
minval = ival;
occurs = 1;
}
//错误,在块外使用ival
int ival = get_value();
if (ival)
cout << "ival = " << ival << endl;
if (!ival)
cout << "ival = 0\n";
//应使用相等而不是赋值
if (ival == 0)
ival = get_value();