写出运行结果,在线等,挺急的!!!

360U3186478964 |浏览807次
收藏|2022/07/04 21:05

满意回答

2022/07/04 21:19

所给程序有错,有许多全角字符,头函数也写错了,等,改正后的程序如下:#include <iostream>using namespace std;class MyClass{char ch;public:MyClass();MyClass(char character);void Print();~MyClass();};MyClass::MyClass(){cout<<"This is a constructor!"<<endl;ch='a';}MyClass::MyClass(char character){cout<<"This is a constructor!"<<endl;ch=character;}void MyClass::Print(){cout<<"The value of ch is "<<ch<<endl;}MyClass::~MyClass(){cout<<"This is a destructor!"<<endl;}int main(){MyClass first,second('b');first.Print();second.Print();return 0;}程序的运行结果:

ygl990951

其他回答(0)
0人关注该问题
+1

 加载中...