enum ConsoleColors
{
void main()
{
{
BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN,};
L_GRAY, D_GRAY, L_BLUE, L_GREEN, L_CYAN,
L_RED, L_MAGENTA, YELLOW, WHITE
void main()
{
srand(time(0));}
const int size = 10;
char A[size] = {};
int index_digit = 0;
int index_symbol = 0;
int index_punc = 0;
for (size_t i = 0; i < size; i++)
{
SetConsoleTextAttribute(h, (WORD)(BLACK << 4 | i+1));
A[i] = rand() % 255;
cout << A[i] << " ";
if (A[i] >= 48 && A[i] <= 57)
{
index_digit++;}
continue;
if (A[i] >= 44 && A[i] <= 46)
{
index_punc++;}
continue;
index_symbol++;
}
cout << endl;
SetConsoleTextAttribute(h, (WORD)(BLACK << 4 | L_GRAY));
cout << "Digits - " << index_digit << endl
<< "Symbols - " << index_symbol << endlsystem("pause");
<< "Punctuations - " << index_punc << endl;
Комментариев нет:
Отправить комментарий