c++读书笔记

--I/O object
in_stream.open("file_name");
in_stream.open("file_name",flag);   flag : ios::in   out  binary   ate  app  trunc
in_stream.fail(); --if file open succeed return true
in_stream.eod() ; --read to end of file
exit(return_value);                 #<stdlib>
cin.get('')   cout.put('') --get or put one char  
getline(cin,string[,delimiter]);
cin.putback   put char back to stream
--I/O format
cout.setf(flag)                     flag : ios::fix  scientific    showpoint  right   left
cout<< setw(4)<<setprecision(2);    #<iomanip>

--string and vector
char a_c_string[] = "this is a string";
string v_sting = a_c_string;
strcpy(a_c_string,v_string.c_str());

vector<double> vct;                 #<vector>
vct.push_back(2.0);
for(unsigned int i =0;i <vct.size(); ++i)  vector.size return unsigned int
vct.size()   vct.capacity()   --size  and  content of  memory
vct.reserve(32)               --set   content size     not use default method

你可能感兴趣的:(c++读书笔记)