#include <iostream>
#include <stdlib.h>
#include <time.h>
#define kk 24
using namespace std;
int *tab1; int *tab2; int *tab3; int *tab4; int *tab5; int *tab6;
int min_T(int a, int b, int c)
{
int d;
d=a;
if(d>=b)
d=b;
if(d>=c)
d=c;
return d;
}
int max_T(int a, int b, int c)
{
int d;
d=a;
if(d<=b)
d=b;
if(d<=c)
d=c;
return d;
}
int mid_T(int a, int b, int c)
{
int d=0;
if(a<=b && a>=c)
d=a;
if(a<=c && a>=b)
d=a;
if(b<=a && b>=c)
d=b;
if(b<=c && b>=a)
d=b;
if(c<=a && c>=b)
d=c;
if(c<=b && c>=a)
d=c;
return d;
}
int main()
{
int i;
srand(time(NULL));
tab1=new int[kk]; tab2=new int[kk]; tab3=new int[kk];
tab4=new int[kk]; tab5=new int[kk]; tab6=new int[kk];
for(i=0;i<kk;i++)
{
tab1[i]=1+rand()%kk;
tab2[i]=1+rand()%kk;
tab3[i]=1+rand()%kk;
tab4[i]=min_T(tab1[i],tab2[i],tab3[i]);
tab5[i]=max_T(tab1[i],tab2[i],tab3[i]);
tab6[i]=mid_T(tab1[i],tab2[i],tab3[i]);
cout<<tab4[i]<<"-"<<tab6[i]<<"-"<<tab5[i]<<endl;
}
delete [] tab6; delete [] tab5; delete [] tab4;
delete [] tab3; delete [] tab2; delete [] tab1;
return 0;
}
Brak komentarzy:
Prześlij komentarz