cout是如何处理char和int的类型转换

// cout是如何处理char和int的类型转换。
#include

int main()
{

	using std :: cin;
	using std :: cout;
		cout << "Type, and I shall repeat.\n";
char ch;cin.get(ch);while (ch!='.'){if ('\n'==ch) // value 放在ch前面,防止将“==”误用为“=”;cout << ch;else//cout << ++ch;cout << ch+1; // ch+1替换++ch 输出的是ASCII嘛,cout自动将ch类型转换为int型cin.get(ch);}cout <<"\nPlease excuse the slight confusion.\n";return 0;}
 
  

你可能感兴趣的:(C++)