Created
November 2, 2012 08:39
-
-
Save Jack2/3999519 to your computer and use it in GitHub Desktop.
[C++]student_score_admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
using namespace std; | |
class Student { | |
public : | |
void SetID(int num) { id = num; } | |
void SetName(char *str){ | |
strcpy(name, str); | |
} | |
int GetID(){ return id; } | |
char *GetName() const{ | |
return (char *) name; | |
} | |
private: | |
int id; | |
char name[30]; | |
}; | |
//enum Subjects { Math, English, Korean }; | |
class Exam{ | |
public : | |
void SetInfo(int id, char *name, char *subj, int num); | |
int GetPoint() const { return point;} | |
void GetResult(int id) const; | |
void SetSubName(char *str){ | |
strcpy(subject, str); | |
} | |
void SetPoint(int num) {point = num;} | |
Student student; | |
private : | |
char subject[30]; | |
int point; | |
}; | |
void Exam::GetResult(int id)const | |
{ | |
cout << "\t\t해당 학생의 성적은 다음과 같습니다" << endl; | |
} | |
void Exam::SetInfo(int id, char *name, char *subj, int num) | |
{ | |
Exam Exam[100]; | |
student.SetID(id); | |
student.SetName(name); | |
Exam[id].SetSubName(subj); | |
Exam[id].SetPoint(num); | |
cout << "\t\t입력한 학생의 성적은 다음과 같습니다" << endl; | |
cout << "\t학번 : " << id ; | |
cout << " 이름 : " << name; | |
cout << " 과목 : " << subj; | |
cout << " 점수 : " << num << endl ; | |
} | |
int main() | |
{ | |
Exam Exam[100]; | |
int menuNum; | |
cout << "\t\t- 성적 관리 프로그램 -" << endl; | |
cout << "\t\t(메뉴를 선택하시오.)" << endl; | |
while( menuNum != 4) | |
{ | |
cout << "\t1. 성적 입력" << endl; | |
cout << "\t2. 성적 조회" << endl; | |
cout << "\t3. 성적 수정" << endl; | |
cout << "\t4. 종료" << endl; | |
cout << "\n\t\t\t메뉴 선택 : " ; | |
cin >> menuNum ; | |
switch(menuNum) | |
{ | |
case 4 : | |
cout << "\t\t이용해 주셔서 감사합니다" << endl; | |
system("exit"); | |
break; | |
case 1: | |
int id; | |
int num; | |
char name[10]; | |
char subj[20]; | |
cout << "\t학번 : " ; | |
cin >> id ; | |
cout << "\t이름 : " ; | |
cin >> name; | |
cout << "\t입력한 학생의 성적을 입력하세요" << endl; | |
cout << "\t과목 : "; | |
cin >> subj; | |
cout << "\t점수 : "; | |
cin >> num; | |
Exam[id].SetInfo(id, name, subj, num); | |
break; | |
case 2 : | |
cout << "조회할 학생의 학번을 입력하세요" << endl; | |
cin >> id; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment