c/c++ 条件语句省略括号写法
1.一种是只有一条执行语句
2.一种是以逗号“,”分隔开,以分号“;”结尾
如:
#include<iostream>
using namespace std;
int main() {
//定义一个test变量
int for_test=1;
if (1) for_test = for_test + 1,cout<<for_test;
cout << for_test;
return 0;
}
1.一种是只有一条执行语句
2.一种是以逗号“,”分隔开,以分号“;”结尾
如:
#include<iostream>
using namespace std;
int main() {
//定义一个test变量
int for_test=1;
if (1) for_test = for_test + 1,cout<<for_test;
cout << for_test;
return 0;
}