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;
}

  

posted on 2020-04-09 16:26  jianW1024  阅读(460)  评论(1编辑  收藏  举报

导航