原创 2.5-1
int main() { double a=9.3; double &b=a; double &c=a; cout<<b<<c<<endl;//9.3 9.3 double &d=b; cout<<d<<endl;
原创 2.7
int main() { enum e{x,y=3,z}; e a=x; e b=y; e c=z; cout<<a<<endl;//0 第一個默認爲0 cout<<b<<endl
原创 9.6.1
int main(){ //string s(1); error string不支持單個容器長度作爲參數的構造函數 string s; //創建string對象時不提供任何參數得到空string st
原创 9.6.2-1
int main(){ string s="welcome"; //使用下標而不是用時代器刪除 s.erase (s.size()-4,4); cout<<s<<endl;//wel s="welcome"; string ::it
原创 8.5-1
#include <sstream> int main(){ string s="hellow world"; string w; istringstream is(s); while(is>>w) { cout<