改错题abcd.docVIP

  • 5
  • 0
  • 约6.02千字
  • 约 22页
  • 2018-05-18 发布于河南
  • 举报
改错题abcd

A卷 二、程序改错题(20分,每题4分) 以下每个程序各有两个错误,请改正,使其能得到正确的运行结果。#includeiostream using namespace std; class Point { private: int x,y=20; //此行有错 public: init(int a,int b) //此行有错 { x=a;y=b;} void show() { coutx= x y=y;} }; void main() { Point pt(24,50); pt.show(); } 2函数swapint用于实现两个整数交换,输出结果是。 #includeiostream using namespace std; void main() { int a1=1,b1=2; couta1=a1,b1=b1endl; swapint(a1,b1); couta1=a1,b1=b1endl; } void swapint(int a,int b) //此行有错 { int t; t=a;a=b;b=t; } 编译时错误提示: error C2065: swapint : undeclared identifier 3生成具有10个元素的动态数组,并对其进行输出。 #include iostream using namespace

文档评论(0)

1亿VIP精品文档

相关文档