学习笔记2

好累啊,即便是做我最喜欢的事情还是这么累,感觉要哭了,最怕被时间推着走,迷茫迷茫迷茫累,能做一点是一点吧

#pragma once
#include <iostream>
#include <string>
using namespace std;
class Theclass
{
private:

public:
    int member_count = 0;
    int Grade;
    int Class;
    Theclass(int _grade, int _class);
    void get_Theclass_infomation();

};
static int student_number = 1;
void add_student();
class Student:public Theclass
{
private:
    string Name = "Eve";
    int Age = 0;
    double chinese_score = 0;
    double math_score = 0;
    bool Gender = false;

public:

    Student();
    int set_Theclass();
    void get_student_infomation();
    double set_scores();
    void get_scores();
};
#include "student.h"
#include <iostream>
#include <string>
using namespace std;
Theclass::Theclass(int _grade =1, int _class =1)
{
    Grade = _grade;
    Class = _class;
}
void Theclass::get_Theclass_infomation()
{
    for (int i = 1; i <= member_count; i++)
    {

    }
}
void add_student()
{
    string studentn[1000];
    for (int i = 0; i < 1000; i++)
    {
        studentn[i] = "00000" + i;
    }
    Student studentn[student_number];
}
int Student::set_Theclass()
{
    cout << "请输入年级:" << endl;
    cin >> Grade;
    cout << "请输入班级:" << endl;
    cin >> Class;
}
Student::Student() 

{
    int ag;
    bool ge;
    cout << "请输入年龄:";
    cin >> ag;
    cout << "请输入性别(0代表男生,1代表女生):";
    cin >> ge;
    string na;
    cout << "请输入名字:";
    cin >> na;
    Name = na;
    Age = ag;
    member_count++;
    student_number++;
}
void Student::get_student_infomation()
{
    cout << "姓名: " << Name << "   性别: " << Gender << "年龄: " << Age << "   班级: " 
        << Grade << "年级" << Class << "班  学号: "  << student_number  << endl;
}
double Student::set_scores()
{
    cout << "请输入语文成绩:" << endl;
    cin >> chinese_score;
    cout << "请输入数学成绩:" << endl;
    cin >> math_score;
}
void Student::get_scores()
{
    cout << "语文: " << chinese_score << "分  数学: " << math_score << "分  平均分: " 
        << (chinese_score + math_score) / 2 << "分  总分: " << chinese_score + math_score 
        << "分" << endl;
}
#include "student.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
    cout << "是否要增加一名学生?" << endl;
    int n;
    cin >> n;
    if (n = 1)
    {
        add_student();
    }
}

半成品的程序,为什么要贴出来呢,大概这样心里会舒服一点吧,,,重点是今天卡在怎么显示Student类的对象的全部信息了,想在声明对象的时候把名字编号化,可是系统不让,脑袋快哭了,想不出来今天

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值