Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

26932 655016 洪川恩 學測成績 #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions 655016/655016.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include <iostream>
using namespace std;
int main() {
int chineseAvg = 0;
int mathAvg = 0;
int scienceAvg = 0;
int englishAvg = 0;
int socialAvg = 0;

int chinese = 0;
int math = 0;
int science = 0;
int social = 0;
int english = 0;

cout << "輸入考試人數:";
int testPeoNum;
cin >> testPeoNum;
int X [testPeoNum][5];
for (int i = 0; i < testPeoNum; i++) {
cout << "輸入國文成績:";
cin >> X [0][i];
chineseAvg += X [0] [i];
chinese = X [0] [i];

cout << "輸入數學成績:";
cin >> X [1][i];
mathAvg += X [1] [i];
math = X [1] [i];

cout << "輸入自然成績:";
cin >> X [2][i];
scienceAvg += X [2] [i];
science = X [2] [i];

cout << "輸入社會成績:";
cin >> X [3][i];
socialAvg += X [3] [i];
social = X [3] [i];

cout << "輸入英文成績:";
cin >> X [4][i];
englishAvg += X [4] [i];
english = X [4] [i];

cout << i + 1 << "號平均:" << (chinese + math + science + social + english) /5 << "\n";
}
cout << "國文總平均:" << chineseAvg / testPeoNum << "\n";
cout << "數學總平均:" << mathAvg / testPeoNum << "\n";
cout << "自然總平均:" << scienceAvg / testPeoNum << "\n";
cout << "社會總平均:" << socialAvg / testPeoNum << "\n";
cout << "英文總平均:" << englishAvg / testPeoNum << "\n";

}