首页 > 其他分享 >2023 5 10

2023 5 10

时间:2023-05-10 20:56:41浏览次数:27  
标签:10 cout age float Person 2023 include name

#include <iostream>
#include<iomanip>
using namespace std;
class Point {
protected:
    float x, y;
public:
    Point(float a, float b) {
        cout <<"Point constructor called" << endl;
        x = a;
        y = b;
    }
    ~Point() {
        cout << "Point destructor called" << endl;
    }
};
class Circle :public Point {
private:
    float r;
public:
    Circle(float a, float b, float c) :Point(a, b) {
        cout << "Circle constructor called" << endl;
        r = c;
    }
    ~Circle() {
        cout << "Circle destructor called" << endl;
    }
    float getCircumference() {
        return 3.14 * r * 2;
    }
};
int main()
{
    float x, y, r;
    cin >> x >> y >> r;
    Circle c(x, y, r);
    cout << fixed << setprecision(2) << c.getCircumference() << endl;
    return 0;
}
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
class Person{
    protected:
    string name;
     int age;
    public:
     Person(){}      
     Person (string p_name, int p_age){
         name=p_name;
         age=p_age;
     }
     void display () {cout<<name<<":"<<age<<endl;}
};
class student:public Person{
    private:
    int ID;
float cpp_score;
float cpp_count;
float cpp_grade;
    public:
    student(){}
    student(string str,int a,int b,float c,float d):Person(str,b){
        ID=a;
        cpp_score=c;
        cpp_count=d;
        cpp_grade=cpp_score * 0.9 + cpp_count * 2;
    }
    void print(){
        cout<<ID<<" "<<name<<" "<<fixed<<setprecision(1)<<cpp_grade<<endl;
    }
};
int main(){
    while(1){
        string str;
        int a;//年龄
        int b;//ID
        float c;//cpp_score
        float d;//cpp_count
cin>>str>>a>>b>>c>>d;
        if(str=="0"){
            break;
        }
    student s1(str,a,b,c,d);
        s1.print();
        
    }
    return 0;
}

 

标签:10,cout,age,float,Person,2023,include,name
From: https://www.cnblogs.com/xuxingkai/p/17389305.html

相关文章

  • 5.10
    #include<iostream>usingnamespacestd;inti=1;voidother(){   staticinta=2;   staticintb;   intc=10;   a+=2;   i+=32;   c+=5;   cout<<"---OTHER---"<<endl;   cout<<"i:"......
  • 5月10日打卡
    例4-11题目描述:设计一个结构体存储学生的成绩信息,需要包括学号年级和成绩三项内容,学号的范围是0到99999999,年级分为freshman、sophomore、junior、、senior四种,成绩包括A、S、C、D四个等级。分析:1.学号包括27个二进制位有效信息,而年级、成绩各包括2个二进制位有效信息,采用......
  • 2023/5/10
    8位二进制转为十进制 如01101001转为105#include<iostream>usingnamespacestd;doublepower(doublex,intn){doubles=1.0;while(n--)s*=x;returns;}intmain(){intv=0;for(inti=7;i>=0;i--){......
  • 2023.5.10——软件工程日报
    所花时间(包括上课):6h代码量(行):0行博客量(篇):1篇今天,上午学习,下午学习。我了解到的知识点:1.了解了一些数据库的知识;2.了解了一些python的知识;3.了解了一些英语知识;5.了解了一些Javaweb的知识;4.了解了一些数学建模的知识;6.了解了一些计算机网络的知识; ......
  • 20230510-20230517
    _今天和老万谈了很久啊。真的,或许我已经做出选择了。或许真的很艰难。或许吧。放弃很难,但坚持更难。归于平凡,归于平淡。我到底是什么样的人呢,要做出什么样的选择。“纯粹的享受这段时光”“每分每秒都是开心的”一时间还不知道跟谁宣布。真的。也不知道怎么面对大家......
  • 2023年5月10日记录
    兔子产子问题问题描述有一对兔子,从出生后的第3个月起每个月都生一对兔子。小兔子长到第3个月后每个月又生一对兔子,假设所有的兔子都不死,问30个月内每个月的兔子总数为多少?      改进方案:   ......
  • 5.10打卡
    一、问题描述:求任意两个正整数的最小公倍数(LCM)。二、设计思路:对于输入的两个正整数m和n,每次输入的大小顺序可能不同,为了使程序具有一般性,首先对整数m和n进行大小排序,规定变量m中存警大数、变量n中存储小数。若输入时m的值小于变量n的值,则需要交换两个变量中存储的内容。再次强调:......
  • 总结20230510
    代码时间(包括上课)2h代码量(行):50行博客数量(篇):1篇相关事项:1、今天上的计算机网络,第五章完成收尾,开启了第六章的应用层。2、今天的另外一节课是毛概,讲的是*提出的问题以及精髓。3、晚上整的还是无人机比赛的飞机的飞行指导。......
  • 5.10
    #include<stdio.h>main(){intx,y,z,number=0;printf("MenwomenChildren\n");for(x=0;x<=10;x++){y=20-2*x;z=30-x-y;if(3*x+2*y+z==50)printf("%2d:%4d%5d%6d\n",++number,x,y,z);}}......
  • day69(2023.5.10)
    第四阶段--网页编程和设计(一)HTML5day571.第一个前端程序2.前端工具的选择与安装3.VScode开发者工具快捷键4.HTML5简介与基础骨架5.标签之标题6.标签之段落、换行、水平线7.标签之图片8.图片路径详解9.标签之超文本链接10.标签之文本11.列表标签之有序列表12.列表标签之无序列表13......