[C++习题.docVIP

  • 168
  • 0
  • 约1.19万字
  • 约 31页
  • 2017-01-06 发布于北京
  • 举报
[C习题

第一章 1.下列程序有什么错误 #includeiostream Using namespce std; Int main() { int x,y,z; cinxy; z=x+y; cout”x+y=”z; } (2)#include iostream using namespace std; class Box { public: int Box(int,int,int); int volume(); private: int height; int width; int length; }; Int Box::Box(int h,int w,int len) { height=h; width=w; length=len; } Int Box:: volume() { return (height*width*length); } void main() { Box box(1,2,3); coutbox.volume()endl; } 2.C++中引用与指针有什么区别? 1.指针可以不用初始化,而引用必须初始化。 2.指针可以赋值为空,而引用不可以。 3.指针的指向可以改变,而引用不可以。 3.程序分析题 #includeiostream using

文档评论(0)

1亿VIP精品文档

相关文档