#include<iostream>
#include<cmath>
using namespace std;
#define COUNT 50
int su(int x)
{
int n = 2;
for (; n <= sqrt(x); n++)
if (x % n == 0)
return 0;
return 1;
}
void Class(int a[], int b[][COUNT])
{
int n = 0, k1 = 0, k2 = 0, k3 = 0, k4 = 0;
for (; n < COUNT; n++)
{
if (a[n] % 2 == 1)
b[0][k1++] = a[n];
else
b[1][k2++] = a[n];
if (su(a[n]))
b[2][k3++] = a[n];
if (a[n] % 5 == 0)
b[3][k4++] = a[n];
}
}
int main()
{
int a[COUNT], b[4][COUNT], p = 0, k = 0, i, j;
char s;
cout << "输入整数:";
cin.get(s);
while (s!='\n')
{
if (s >= '0' && s <= '9')
{
k *= 10;
k += int(s)-48;
}
else
{
a[p++] = k;
k = 0;
}
cin.get(s);
}
a[p++] = k;
Class(a, b);
for (i = 0; i < 4; i++)
{
switch (i)
{
case(0):cout << "奇数:"; break;
case(1):cout << "偶数:"; break;
case(2):cout << "素数:"; break;
default:cout << "被5整除:";
}
for (j = 0; j < COUNT; j++)
{
if (b[i][j] == -858993460)
break;
cout << b[i][j] << ' ';
}
cout << '\n';
}
system("pause");
return 0;
}