文章分类 - C++基础复习
对C++的一个复习,为毕业后找工作打下比较好的基础
摘要:面试必考。。。。。 1 #include <stdio.h> 2 class CBase 3 { 4 public: 5 virtual void f(int x) 6 { 7 printf("CBase::f 函数打印:整数%d\n",x); 8 } 9 10 void g(float x)11 {12 printf("CBase::g 函数打印:浮点小数%f\n",x);13 }14 };15 16 // 继承类 CDerived17 class CDerived:public CBase18 {19 publ...
阅读全文
摘要:#include <fstream> 三个类: 类名 (默认的方式)读 ifstream ios::in写 ofstream ios::out读/写 fstream ios::in | ios::out openmode 打开模式说明ios::in 以读取方式打开文件ios::out 以写入方式打开文件ios::app 每次写入数据时,先将文件指针移到文件尾,以追加数据到尾部(append)ios::ate 进初始时将文件指针移到文件尾,仍可以在任意位置写入数据(at end)ios::trunc 写入数据前,先删除文件原有内容(清空文件),当文件不存在时,会...
阅读全文