-3
我正在爲我的作業開發一個等級分析程序。數組可以保持6個等級,如果輸入了另一個等級,它將返回錯誤。 但我在如何添加到數組中遇到問題。我有兩個班,因爲任務要求兩個班。 這是給出的類,我只需要實現它。靜態列表,鏈接列表
class StaticList
{
public:
StaticList()
{
List[MAXCELLS] = 0;
Counter = 0;
}
bool Add(ListType)
{
ListType a =0;
Counter = 0;
while (Counter < MAXCELLS)
{
Counter++;
List[Counter] = a;
}
return true;
}
private:
ListType List[MAXCELLS];
int Counter;
};
這是我的其他類我做
class Stats
{
public:
bool NewGrade(ListType)
{
StaticList tmp;
ListType a = 0;
//if grade fits in array return true
tmp.Add(a);
if (!tmp.Add(a))
{
return true;
}
else
return false;
}
};
什麼ListType? – 2014-09-28 23:39:31
你的問題是什麼? – 2014-09-28 23:39:43
ListType是給定的typedef浮點數。我很抱歉沒有添加。 – 2014-09-28 23:43:09