This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/DataStructure/Code/ex06/score.h

41 lines
651 B
C
Raw Permalink Normal View History

2021-10-27 15:40:44 +00:00
class Score
{
private:
int time = 0;
int *_s;
int _size;
public:
Score(int i)
{
_size = i;
_s = new int[_size - 1];
2021-10-28 11:30:56 +00:00
for (int i = 0; i < _size; i++)
2021-10-27 15:40:44 +00:00
{
2021-10-28 11:30:56 +00:00
_s[i] = 0;
2021-10-27 15:40:44 +00:00
}
}
void finish(int t)
{
2021-10-28 11:30:56 +00:00
_s[t] = 3 - 1 - (time++);
2021-10-27 15:40:44 +00:00
}
bool isFinish(int i)
{
if (_s[i] > 0)
return true;
return false;
}
int score(int i)
{
return _s[i];
}
bool isallFinish()
{
for (int i = 0; i < _size; i++)
{
if (!isFinish(i))
return false;
}
return true;
}
};