
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*/
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)