質問編集履歴
4
コードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -65,7 +65,7 @@
|
|
65
65
|
|
66
66
|
string getName(){ return name;}
|
67
67
|
string getCode(){return code;}
|
68
|
-
float getavgGrade{ return avgGrade;}
|
68
|
+
float getavgGrade(){ return avgGrade;}
|
69
69
|
};
|
70
70
|
|
71
71
|
///1. Read all data from the file into the class stack
|
3
コードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
class Data{
|
55
55
|
string code;
|
56
56
|
string name;
|
57
|
-
float avgGrade;
|
57
|
+
float avgGrade;//https://gradecalculator.mes.fm/weighted-average-calculator
|
58
58
|
P sum[1000];
|
59
59
|
public:
|
60
60
|
Data *pNext; /// pointer to next data
|
@@ -85,12 +85,10 @@
|
|
85
85
|
Data *temp; /// temporary node
|
86
86
|
string line;
|
87
87
|
if(myFile.is_open()){
|
88
|
-
temp = new Data; /// memory for new data
|
89
|
-
if(getline(myFile, line))temp->setData(line); /// parse new data
|
90
88
|
while(getline(myFile,line)){
|
91
89
|
temp = new Data; /// memory for new data
|
92
90
|
temp->setData(line);
|
93
|
-
temp->setSum();
|
91
|
+
temp->setSum();//ここの入力
|
94
92
|
temp->setavgGrade();
|
95
93
|
d = temp; /// set current node as top node
|
96
94
|
|
2
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
ファイルから入力を受け取り、その人の平均成績を出すプログラムです。クラスを使っているのですが、クラスのメンバ変数にはその人が取った単位数に基づいた成績をいれます。
|
1
|
+
ファイルから入力を受け取り、その人の平均成績を出すプログラムです。クラスを使っているのですが、クラスのメンバ変数のavgGradeにはその人が取った単位数に基づいた成績をいれます。
|
2
2
|
[成績計算の参照](https://gradecalculator.mes.fm/weighted-average-calculator)
|
3
3
|
|
4
4
|
|
1
修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
クラスの値保持
|
1
|
+
クラスの使い方(値保持とファイル入力)
|
body
CHANGED
File without changes
|