酷代码 AI
菜单
全部AI  /  热门  /  AI写代码神器
服务商

用c++变成一个学习管理系统内容包括学习环境,时间管理,学习内容,学习方法学习内容的排序学习内容的修改学习内容的增添

#include <iostream> #include <string> #include <vector> class StudyManagementSystem { private: struct StudyContent { std::string content; std::string method; }; std::string studyEnvironment; std::string timeManagement; std::vector<StudyContent> studyContents; public: void setStudyEnvironment(const std::string& environment) { studyEnvironment = environment; } void setTimeManagement(const std::string& time) { timeManagement = time; } void addStudyContent(const std::string& content, const std::string& method) { StudyContent newStudyContent; newStudyContent.content = content; newStudyContent.method = method; studyContents.push_back(newStudyContent); } void modifyStudyContent(int index, const std::string& newContent, const std::string& newMethod) { if (index >= 0 && index < studyContents.size()) { studyContents[index].content = newContent; studyContents[index].method = newMethod; } else { std::cout << "Invalid index" << std::endl; } } void displayStudyContents() { for (int i = 0; i < studyContents.size(); i++) { std::cout << i + 1 << ". " << studyContents[i].content << " - " << studyContents[i].method << std::endl; } } void sortStudyContents() { // Sort study contents here, e.g., alphabetically } }; int main() { StudyManagementSystem system; system.setStudyEnvironment("Quiet room with no distractions"); system.setTimeManagement("Using a planner to schedule study sessions"); system.addStudyContent("Mathematics", "Practice problems and review concepts"); system.addStudyContent("History", "Reading and note-taking"); system.displayStudyContents(); system.modifyStudyContent(0, "Computer Science", "Coding and debugging"); system.displayStudyContents(); system.addStudyContent("Biology", "Labs and research"); system.sortStudyContents(); system.displayStudyContents(); return 0; } [2024-07-01 09:22:39 | AI写代码神器 | 1410点数解答]

相关提问