ostream中put()用于显示字条,write()用于显示字符串,它有两个参数,第一个参数为字符中的地址,第二个参数指出要显示多少个字符。 #include using namespace std; void main() { char *pstr="Hello word"; cout.put('A').put('m').put(70); cout.put('\n'); cout.write(pstr,5); cout.write(pstr+5,6); cout<<endl; cout.write("happy",5); cout<<endl; }