System::Int64 min_Table(array<System::Int64>^ table,System::Int64 size)
{
System::Int64 i;
System::Int64 min;
min=table[0];
for(i=1;i<size;i++)
if(table[i]<min)
min=table[i];
return min;
}
System::Int64 max_Table(array<System::Int64>^ table,System::Int64 size)
{
System::Int64 i;
System::Int64 max;
max=table[0];
for(i=1;i<size;i++)
if(table[i]>max)
max=table[i];
return max;
}
System::Int64 sum_Table(array<System::Int64>^ table,System::Int64 size)
{
System::Int64 i;
System::Int64 sum;
sum=0;
for(i=0;i<size;i++)
sum+=table[i];
return sum;
}
System::Double average_Table(array<System::Int64>^ table,System::Int64 size)
{
System::Double average;
average=(1.0*sum_Table(table,size))/(1.0*size);
return average;
}
System::Void reverse_Tables(array<System::Int64>^ table1,array<System::Int64>^ table2,System::Int64 size)
{
array<System::Int64>^ temp;
System::Int64 i;
temp=gcnew array<System::Int64>(size);
for(i=0;i<size;i++)
temp[i]=table1[i];
for(i=0;i<size;i++)
table1[i]=table2[i];
for(i=0;i<size;i++)
table2[i]=temp[i];
}
System::Int64 even_in_Table(array<System::Int64>^ table,System::Int64 size)
{
System::Int64 sum_even;
System::Int64 i;
sum_even=0;
for(i=0;i<size;i++)
if(table[i]%2==0)
++sum_even;
return sum_even;
}
System::Int64 odd_in_Table(array<System::Int64>^ table,System::Int64 size)
{
System::Int64 sum_odd;
System::Int64 i;
sum_odd=0;
for(i=0;i<size;i++)
if(table[i]%2!=0)
++sum_odd;
return sum_odd;
}
System::Boolean is_in_Table(array<System::Int64>^ table,System::Int64 size,System::Int64 find_value)
{
System::Boolean temp_bool;
System::Int64 i;
temp_bool=false;
for(i=0;i<size;i++)
if(find_value==table[i])
temp_bool=true;
return temp_bool;
}
System::Void make_array_Table(array<System::Int64>^ table,System::Int64 size)
{
Array^ array_Table;
System::Int64 i;
array_Table=Array::CreateInstance(System::Int64::typeid,size);
for(i=0;i<size;i++)
array_Table->SetValue(table[i],i);
}
System::Void make_double_Table(System::Int64 size1, System::Int64 size2,System::Int64 max_value)
{
array<System::Int64,2>^ double_Table;
System::Int64 i;
System::Int64 j;
Random^ random_value=gcnew Random();
double_Table=gcnew array<System::Int64,2>(size1,size2);
for(i=0;i<size1;i++)
for(j=0;j<size2;j++)
double_Table[i,j]=random_value->Next(max_value);
}
Brak komentarzy:
Prześlij komentarz