#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
#define max_Size 1000
#define rand_Size 100
using namespace std;
struct int_Point
{
int x;
int y;
int z;
};
struct float_Point
{
float x;
float y;
float z;
};
bool min_Sort(int a, int b, int c)
{
if((a<b) && (b<c))
return true;
else
return false;
}
int main()
{
int a,b,c,i;
float a1,b1,c1;
float a2,b2,c2;
int a3,b3,c3;
srand(time(NULL));
int_Point *i_P;
float_Point *f_P;
float_Point *g_P;
int_Point *h_P;
i_P=new struct int_Point[max_Size];
f_P=new struct float_Point[max_Size];
g_P=new struct float_Point[max_Size];
h_P=new struct int_Point[max_Size];
for(i=0;i<max_Size;i++)
{
a=1+rand()%rand_Size; a1=(a*1.00)/100.;a2=1.00-a1;a3=int(a2*100.);
b=1+rand()%rand_Size; b1=(b*1.00)/100.;b2=1.00-b1;b3=int(b2*100.);
c=1+rand()%rand_Size; c1=(c*1.00)/100.;c2=1.00-c1;c3=int(c2*100.);
i_P[i].x=a; f_P[i].x=a1; g_P[i].x=a2; h_P[i].x=a3;
i_P[i].y=b; f_P[i].y=b1; g_P[i].y=b2; h_P[i].y=b3;
i_P[i].z=c; f_P[i].z=c1; g_P[i].z=c2; h_P[i].z=c3;
if(min_Sort(a,b,c))
{
float *sum;
sum=new float[3];
sum[0]=(1.00*i_P[i].x)+f_P[i].x+g_P[i].x+(1.00*h_P[i].x);
sum[1]=(1.00*i_P[i].y)+f_P[i].y+g_P[i].y+(1.00*h_P[i].y);
sum[2]=(1.00*i_P[i].z)+f_P[i].z+g_P[i].z+(1.00*h_P[i].z);
float all_s=sum[0]+sum[1]+sum[3];
cout<<i_P[i].x<<"+"<<f_P[i].x<<"+"<<g_P[i].x<<"+"<<h_P[i].x<<"="<<sum[0]<<endl;
cout<<i_P[i].y<<"+"<<f_P[i].y<<"+"<<g_P[i].y<<"+"<<h_P[i].y<<"="<<sum[1]<<endl;
cout<<i_P[i].z<<"+"<<f_P[i].z<<"+"<<g_P[i].z<<"+"<<h_P[i].z<<"="<<sum[2]<<endl;
cout<<"All = "<<all_s<<endl;
delete [] sum;
}
}
delete [] i_P;
delete [] f_P;
delete [] g_P;
delete [] h_P;
getch();
return 0;
}
YOU CAN PAY ME - https://paypal.me/LukaszW77?locale.x=pl_PL