内容:
说明:
主要是一些基本类型的输入和输出(C++用cin和cout,C用scanf和printf)
示例代码:
// BasicDateTypes.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
using namespace std;
//by zhaocl
int main()
{
int a;
long b;
char c;
float d;
double e;
cin >> a >> b >> c >> d >> e;
cout << a << endl;
cout << b << endl;
cout << c << endl;
cout.precision( 3 );
cout << fixed << d << endl;
cout.precision( 6 );
cout << fixed << e << endl;
system( "pause" );
return 0;
}
基础知识点:
1、集中数据类型对应的数据格式
2、cout输出时对于小数位数的控制(precition和fixed)