enum EGrade
{
ESTAR5,
ESTAR4,
ESTAR3,
ESTAR2,
ESTAR1,
ENONESTAR
};
enum EItem
{
EA_Item,
EB_Item,
EC_Item,
ED_Item,
EE_Item,
EF_Item,
EG_Item,
EH_Item,
EI_Item,
EJ_Item,
EK_Item,
ENONEITEM
};
int arr[11];
void GradeSelection(vector<char>& percent, EGrade& grade, int n);
void InitialPercentArr(vector<char>& percent);
int main()
{
vector <char> percent(100);
EGrade grade = EGrade::ENONESTAR;
EItem Item = EItem::ENONEITEM;
int n, r;
InitialPercentArr(percent);
while (1)
{
for (int i = 0; i < 11; i++)
arr[i] = 0;
cin >> n;
if (n == -1)
break;
random_shuffle(percent.begin(), percent.end());
GradeSelection(percent, grade, n);
for (int i = 0; i < 11; i++)
printf(" %c : %d ", 65 + i, arr[i]);
cout << endl << endl;
}
return 0;
}
void GradeSelection(vector<char>& percent, EGrade &grade, int n)
{
for (int i = 0; i < n; i++)
{
switch (percent[i % 100])
{
case 'A':
if(n < 99)
grade = EGrade::ESTAR5;
arr[0]++;
break;
case 'B':
grade = EGrade::ESTAR4;
arr[1]++;
break;
case 'C':
grade = EGrade::ESTAR4;
arr[2]++;
break;
case 'D':
grade = EGrade::ESTAR3;
arr[3]++;
break;
case 'E':
grade = EGrade::ESTAR3;
arr[4]++;
break;
case 'F':
grade = EGrade::ESTAR3;
arr[5]++;
break;
case 'G':
grade = EGrade::ESTAR2;
arr[6]++;
break;
case 'H':
grade = EGrade::ESTAR2;
arr[7]++;
break;
case 'I':
grade = EGrade::ESTAR2;
arr[8]++;
break;
case 'J':
grade = EGrade::ESTAR2;
arr[9]++;
break;
case 'K':
grade = EGrade::ESTAR1;
arr[10]++;
break;
}
}
}
void InitialPercentArr(std::vector<char>& percent)
{
int i = 0;
percent[0] = 'A';
for (i = 1; i <= 3; i++)
percent[i] = 'B';
for (i = 4; i <= 6; i++)
percent[i] = 'C';
for (i = 7; i <= 11; i++)
percent[i] = 'D';
for (i = 12; i <= 16; i++)
percent[i] = 'E';
for (i = 17; i <= 21; i++)
percent[i] = 'F';
for (i = 22; i <= 31; i++)
percent[i] = 'G';
for (i = 32; i <= 41; i++)
percent[i] = 'H';
for (i = 42; i <= 51; i++)
percent[i] = 'I';
for (i = 52; i <= 61; i++)
percent[i] = 'J';
for (i = 62; i <= 99; i++)
percent[i] = 'K';
}
'콘솔창 & 윈도우창' 카테고리의 다른 글
야구 게임 (0) | 2024.07.08 |
---|---|
배열 가로 세로 값 구하기 (0) | 2024.07.04 |
지그재그 출력 (0) | 2024.07.03 |
로또 번호 생성 프로그램 (0) | 2024.06.27 |