面向对象离线离线作业答案摘要.docVIP

  • 208
  • 0
  • 约3.25万字
  • 约 38页
  • 2016-04-20 发布于湖北
  • 举报
《面向对象程序设计》作业答案 第2章 【2.3】 测试下面的注释(它在C++风格的单行注释中套入了类似于C的注释)是否有效。 //this is a strange /*way to do a comment*/ 答:有效 【2.4】 以下这个简短的C++程序不可能编译通过,为什么? #includeiostream using namespace std; int main() {int a,b,c; coutEnter two numbers:; cinab; c=sum(a,b); coutsum is:c; return 0; } sum(int a,int b) { return a+b; } 答:不能sum使用前必须声明 【2.5】 回答问题。 (1) 以下两个函数原型是否等价: float fun(int a,float b,char *c); float fun(int,float,char * ); 等价 (2) 以下两个函数的第一行是否等价: float fun(int a,float b,char * c); float fun(int,float,char * ); 答:等价 【2.6】 下列语句中错误的是(C )。 A.int *p=new int

文档评论(0)

1亿VIP精品文档

相关文档