摘要: 1、静态转换 static_cast static_cast 全部用于明确定义的变换,包括编译器允许我们所做的不用强制转换的“安全”变换和不太安全但清楚定义的变换。 static_cast包含的转换类型包括典型的非强制变换、窄化(有信息丢失)变换,使用void* 的强制变换、隐式类型变换和类层次的静态定位。 int i = 0x7fff;//32767 long l; float f; //Typical castless conversions: l = i; f = i; cout<<l<<endl; cout<<f<<endl; ... 阅读全文
posted @ 2013-03-10 22:04 wiessharling 阅读(246) 评论(0) 推荐(0)
摘要: #include<iostream>#include<fstream>using namespace std;int main(){ifstream in("in.cpp"); ofstream out("out.cpp"); string s; while(getline(in,s)) { cout<<s<<"\n"; out<<s<<"\n"; }return 0;} 阅读全文
posted @ 2013-03-10 21:16 wiessharling 阅读(136) 评论(0) 推荐(0)