C++程序计与问题求解习题与答案.docVIP

  • 14
  • 0
  • 约6.13千字
  • 约 9页
  • 2016-12-06 发布于贵州
  • 举报
C程序计与问题求解习题与答案

课号 课程名称 程序设计与问题求解 适用班级(专业) 考试时间 120 分钟 座位号 学号 姓名 题号 一 二 三 四 五 六 七 八 成绩 满分 50 10 40 得分 评卷人 一、阅读程序,写出程序运行结果(每题10分,5题共50分) 简单的类定义 #includeiostream #includestring using namespace std; #includeiostream using namespace std; class MyClass { int m; public: static int n; MyClass( ) {m=0;} void setvalue( ){ m++; n++; } void output( ){ coutm=m, n=nendl; } }; int MyClass:: n=2; void main( ) { MyClass obj1, obj2; obj1.setvalue( ); obj1.output( ); obj2.setvalue( ); obj2.output( ); }

文档评论(0)

1亿VIP精品文档

相关文档