【例112】cout应用举例2。 #include <iostream.h> void main(void) char name="zhang San"; int age=25 cout<<Output the name and age <<name<<w<<age<<end; 人民邮电出版社 POSTS tEl OM PRE 动此映
【例11.2】cout应用举例2。 #include <iostream.h> void main(void) { char name[]="Zhang San"; int age=25; cout<<"Output the name and age : "<<name<<" "<<age<<endl; }
运行程序,输出结果为: Output the name and age: Zhang San 25 人民邮电出版社 POSTS tEl OM PRE 动此映
运行程序,输出结果为: Output the name and age:Zhang San 25
【例114】以十六进制形式输出显示结果。 #include <iostream.h> void main(void) float x=888.; float*p=&xs cout<<x:"<<x<<t&x: t"<<&x<<end; cout<<*p:t<<p<<tp: t <<p<<endl; cout<<&p:"<<&p<<end; 人民邮电出版社 POSTS tEl OM PRE 动此映
【例11.4】以十六进制形式输出显示结果。 #include <iostream.h> void main(void) { float x=888.; float* p=&x; cout<<"x:\t"<<x<<"\t&x:\t"<<&x<<endl; cout<<"*p:\t"<<*p<<"\tp:\t"<<p<<endl; cout<<"&p:\t"<<&p<<endl; }
运行程序,输出结果为: X 888 &x: 0x0012FF7C 888 0x0012FF7C &p 0x0012FF78 人民邮电出版社 POSTS tEl OM PRE 动此映
运行程序,输出结果为: x: 888 &x: 0x0012FF7C *p: 888 p: 0x0012FF7C &p: 0x0012FF78
11.2.1.2常见错误 11.2.1.3物出成员函数 1.put()函数 成员函数put()把单个字符写入输出流中。 人民邮电出版社 POSTS tEl OM PRE 动此映
11.2.1.2 常见错误 11.2.1.3 输出成员函数 1. put()函数 成员函数put()把单个字符写入输出流中