C上机期末考题答案.docxVIP

  • 7
  • 0
  • 约2.12千字
  • 约 4页
  • 2021-01-01 发布于山东
  • 举报
一 改错 阅读下列程序,改正程序中的错误。 ( 1) class A {private: int x,y ; public : void fun(int i,int {x=i;y=j ;} void show()  j=0 ) {coutx “” yendl;} } ; void main() {A a1; (2); (); } 2) #include iostream class Date; class Time {public: Time(int h,int m,int s) {hour=h,minute=m,sec=s ;} void show(Date d) ; private: int hour,minute,sec; }; class Date {public: Date(int m,int d,int y) {month=m,day=d,year=y;} friend void Time::show(Date ) ; private: int month,day,year; }; void Time::show(Date d) {cout --endl; couthour:minute:secendl;} void main() {Time t1(9,23,50); Date d1(12,20,2008); (d1);} (3) #include class

文档评论(0)

1亿VIP精品文档

相关文档