将下列程序补充完整,不能修改主函数的内容,使得程序的输出结果为 姓名: 王华 工号: 201107

将下列程序补充完整,不能修改主函数的内容,使得程序的输出结果为 姓名: 王华 工号: 201107,第1张

#include <iostream>#include <string>using namespace std 

class Person{private:

string namepublic:

Person(){}

Person(string) void show()

}

 

Person::Person(string name):name(name){} 

void Person::show(){

cout<<"姓名:"<<this->name<<endl

class Employee:public Person{private:

string enopublic:

Employee(){}

Employee(string) void show()

}

Employee::Employee(string eno):eno(eno){}void Employee::show(){

cout<<"工号:"<<this->eno<<endl

class Teacher:public Employee,Person{private:

string degreepublic:

Teacher(){}

Teacher(string,string,string) void show()

}

Teacher::Teacher(string name,string eno,string degree):degree(degree){

Person(name).show()

Employee(eno).show()

}void Teacher::show(){

cout<<"学历:"<<this->degree<<endl

int main(){

Teacher tea("abcdef","12345","doctor")

tea.show()

return 0

}

#include <stdio.h>

int main() {

int m,n = 0,t = 0

scanf("%d",&m)

/*填写程序段begin*/

while(m) {

t = m%10

if(t%2 == 0) ++n

m /= 10

}

printf("偶数个数为:%d\n",n)//计算出来偶数的个数赋值给n输出

return 0

/*end*/

}


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/11102905.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-13
下一篇2023-05-13

发表评论

登录后才能评论

评论列表(0条)

    保存