全文预览

《c程序设计》谭浩强课后习题答案

上传者:业精于勤 |  格式:pdf  |  页数:129 |  大小:9998KB

文档介绍
eader! .h\r#include <string>\rnamespace student 1\r{class Student\r{public:.\rStudent(int n,string nam,int a,string addr)\r{num=n;name=nam;age=a;address=addr;}\rvoid show_data();\rprivate:\rint num;\rstring name;\rint age;\rstring address;\r);\rvoid Student::show_data()\r{coutnnum :"num H name:M n am e " age: nage\r<<" address: naddressendl;\r)\r)\r14.3 H2\r//header2.h\r#include <string>\rnamespace student2\r{class Student\r{public:\rStudent(int n,string nam,char s,float sco)\r{num=n;name=nam;sex=s;score=sco;}\rvoid show_data();\rprivate:\rint num;\rstring name;\rchar sex;\rfloat score;\r)0\rvoid Student::show_data()\r{coutnnum:n n u m  n name:', n a m e  ,' sex:usex\r<<" score:uscoreendl; }

收藏

分享

举报
下载此文档