面向对象离线作业1.docVIP

  • 107
  • 0
  • 约1.89万字
  • 约 41页
  • 2017-06-02 发布于河南
  • 举报
面向对象离线作业1

第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; } 【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】 下列语句中错误的是( )。 A.int *p=new int(10) B.int *p=new int[10]; C.int *p=new

文档评论(0)

1亿VIP精品文档

相关文档