проект2

未关闭
#725 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
15/100
Issue 类型
文档
描述清晰度
需要澄清
活跃度
停滞
技术栈
cpp
领域
content

调研方向

首先检查所粘贴的 C++ 程序,并确定它是否属于此 repository 的教育材料。未确定任何项目文件、测试或具体修正,因此在工作可以被视为完成之前,该 issue 需要明确的目标和验收标准。

由索引模型根据 Issue 内容生成。

描述

грамотно ли написан следующий код:
#include
#include
#include
#include

using namespace std;

struct Student {
string name;
vector grades;
};

// Функция для определения успеваемости
string determinePerformance(const vector& grades) {
bool hasFive = false;
bool hasFour = false;
bool hasThree = false;
bool hasTwo = false;

for (int grade : grades) {
    if (grade == 5) hasFive = true;
    if (grade == 4) hasFour = true;
    if (grade == 3) hasThree = true;
    if (grade == 2) hasTwo = true;
}

if (hasTwo) return "Угроза отчисления";
if (hasThree) return "Надо стараться лучше";
if (hasFive && !hasFour) return "Молодец";
if (hasFive && hasFour) return "Хорошо";
if (hasFour && !hasFive) return "Неплохо";
return "У вас есть стипендия";

}

// Функция для вычисления среднего балла
double calculateAverage(const vector& grades) {
double sum = 0;
for (int grade : grades) {
sum += grade;
}
return sum / grades.size();
}

int main() {
// Данные студентов
vector students = {
{"Иванов Иван", {5, 5, 5, 4}},
{"Максимов Максим", {4, 3, 4, 4}},
{"Андреевич Андрей", {3, 3, 5, 5}}
};

// Вывод информации о каждом студенте
for (const auto& student : students) {
    cout << "Имя: " << student.name << endl;
    cout << "Оценки: ";
    for (int grade : student.grades) {
        cout << grade << " ";
    }
    cout << endl;
    cout << "Средний балл: " << calculateAverage(student.grades) << endl;
    cout << "Успеваемость: " << determinePerformance(student.grades) << endl;
}

return 0;

}

主要语言
Jupyter Notebook
星标
5.2k
派生
5.3k
平均合并
4 天 10 小时
30 天内合并 PR
10

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

realpython/materials 的其他 Issue

查看 realpython/materials 的全部 Issue

相似的 Issue

更多 Content Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。