使用cout输出注意事项

#include<iostream>
using namespace std;
int main()
{
	cout<<100<<endl<<'A'<<endl<<"3.140000"<<endl;
	cout<<("100\nA\n3.140000");
	printf("100\nA\n3.140000");
	return 0;
 } 

使用cout输出与printf优
使用cout无需匹配数据类型和双引号,但是不输出小数后的0(除非使用双引号)
总体来说cout比printf好用

猜你喜欢

转载自blog.csdn.net/qq_43813373/article/details/88259519