【C++学习教程02】运算符

参考资料

  • 范磊C++(5课)
  • Xcode平台

代码

#include "stdafx.h"
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
	// insert code here...
	int a = 1;
	int b = 1;
	cout << "a:" << endl;
	cout << ++a << endl;//先加再取
	cout << a << endl;//先加再取
	cout << "b:" << endl;
	cout << b++ << endl;//先取再加
	cout << b << endl;//先取再加
	//****三目运算****
	char char_a;
	cin >> char_a;
	cout << (char_a=(char_a >= 'A'&& char_a <= 'Z') ? (char_a + 32):char_a)<<endl;//大写转化为小写
	cout << ((char)((char_a >= 'A'&& char_a <= 'Z') ? (char_a + 32) : char_a)) << endl;
	system("pause");
	return 0;
}
原文地址:https://www.cnblogs.com/vrijheid/p/14222968.html