国产成人AV一区二区三区在线_国产成人精品无码免费看_国产成人无码无卡在线观看_国产精品成人A区在线观看_国产日韩精品欧美一区_国产亚洲精品自在久久蜜TV_久草热久草热线频97精品_久久久噜噜噜久久中文福利_久久婷婷五月综合色国产免费观看_日日狠狠久久偷偷色综合0,九一桃色在线观看,久久97精品久久久久久久不卡,国产成人精品亚洲精品

寫出運行結(jié)果,在線等,挺急的?。?!

訪客2024-12-02 07:28:481

#include <iostream.h>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;}void main(){MyClass first,second('b');***.print();***.print();}

所給程序有錯,有許多全角字符,頭函數(shù)也寫錯了,等,,改正后的程序如下:

#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;}

程序的運行結(jié)果:

寫出運行結(jié)果,在線等,,挺急的!??!

文章評論