面試題系列(7)

84.將文字轉爲數字:atoi,atof ;將數字轉爲文本:sprintf
85.虛函數:virtual在基類內部增加1條指針變量(指向多個函數地址的指針數組的地址)
86.加強記憶:MFC: CList  CArray CString  CMap(哈希表)//MFC集合類:數據結構(算法流程)
C++STL標準模板庫   std: list  vector string    map(二叉樹)//通用容器類,面試時考察調用方式(循環、遍歷刪除查找)
CString      string
GetLength  size
substr        Mid

CString:從對象中取出指針:opeartor const char*
string:從對象中取出指針:const char*c_str( );
由指針到對象:構造函數
通用:+= + =
default:缺省構造(無參數構造)
basic_string( );
copy:拷貝構造
basic_string(const basic_string& str);
substring:部分提取(截斷)
basic_string(const basic_string& str,size_type pos,size_type len=npos,const allocator_type& alloc=allocator_type( ));
from c-string(4):由指針到對象
basic_string(const charT* s,const allocator_type& alloc=allocator_type( ));
from sequence(5):從指針截斷
basic_string(const charT*s,size_type n,const allocator_type& alloc=allocator_type( ));
fill(6):填充
basic_string(size_type n,charT c,const allocator_type&alloc=allocator_type( ));
fill(7):區間
template<class InputIterator>
     basic_string(InputIterator first,InputIterator last,
const allocator_type&alloc=allocator_type());
88.string中沒有類型轉化:(const char *),可以用str.c_str( ) 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章