/*
#include "stdio.h"
void DeleteDuplicate(int*, int*, int*);
void DeleteEven(int*, int*, int*);
void DeletePrime(int*, int*, int*);
void print(int*, int);
void bubble(int*, int);
void add(int*, int*);
int main()
{
int num[256], uqnum[256];
int rcv, i, game;
int count=0;
printf("Type numbers except 0(type 0 at the end): ");
for (i=0; i<256; i++){
scanf("%d", &rcv);
if (rcv==0)
break;
else {
num[i]=rcv;
count+=1;
}
}
DeleteDuplicate(uqnum, num, &count);
bubble(num, count);
print(num, count);
for (;;){
//Choose a game
printf("1. Add numbers\n2. Remove even numbers\n3. Remove prime numbers\n4. Exit\nGame number: ");
scanf("%d", &game);
printf("\n");
if (game==4)
break;
else{
switch (game)
{
case 1: printf("Type numbers you want to add except 0(type 0 at the end)\n: ");
add(num, &count);
break;
case 2: printf("Remove even\n");
DeleteEven(uqnum, num, &count);
break;
case 3: printf("Remove prime\n");
DeletePrime(uqnum, num, &count);
break;
}
}
DeleteDuplicate(uqnum, num, &count);
bubble(num, count);
print(num, count);
}
return 0;
}
void print(int a[], int n)
{
int i;
printf("\nResult: ");
for (i=0; i<n; i++){
printf("%d ", a[i]);
}
if (n!=1)
printf("(%d numbers)\n\n", n);
else
printf("(one number)\n\n");
}
void DeleteDuplicate(int a[], int b[], int *n)
{
int h, i, j, k;
int count=*n;
for (h=0; h<256; h++){
a[h]=0;
}
for (i=0; i<*n; i++){
for (j=0; j<*n; j++){
if (a[j]!=b[i]&&a[j]==0){
a[j]=b[i];
break;
}
if (a[j]==b[i]){
count--;
break;
}
}
}
*n=count;
for (k=0; k<count; k++){
b[k]=a[k];
}
}
void DeleteEven(int a[], int b[], int *n)
{
int h, i, j=0 ,k;
int count=*n;
for (h=0; h<*n; h++){
a[h]=0;
}
for (i=0; i<*n; i++){
if (b[i]%2!=0){
a[j]=b[i];
j++;
}
else
count--;
}
*n=count;
for (k=0; k<count; k++){
b[k]=a[k];
}
}
void DeletePrime(int a[], int b[], int *n)
{
int h=0, i, j, k, l=0, count=0;
int count2=*n;
for (h=0; h<*n; h++){
a[h]=0;
}
for (i=0; i<*n; i++){
for (j=1; j<=b[i]; j++){
if (b[i]%j==0)
count++;
}
//1 or
if (count==2){
count2--;
count=0;
}
else {
a[l]=b[i];
l++;
count=0;
}
}
*n=count2;
for (k=0; k<count2; k++){
b[k]=a[k];
}
}
//Sort by size
void bubble(int a[], int n)
{
int temp;
int i, j;
for (j=0; j<n; j++){
for (i=0; i<n-1; i++){
if (a[i]>=a[i+1]){
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
}
}
void add(int a[], int *n)
{
int i;
int rcv;
int count=*n;
for (i=*n; i<256; i++){
scanf("%d", &rcv);
if (rcv==0)
break;
else {
a[i]=rcv;
count++;
}
}
*n=count;
}
*/