#pragma endregion
private:
System::Boolean is_First(System::Int64 value)
{
System::Int64 i;
System::Int64 sum;
sum=0;
for(i=1;i<value+1;i++)
if(value%i==0)
++sum;
if(sum==2)
return true;
else
return false;
}
private:
array<System::Boolean,2>^ tab_Bool;
private:
array<System::Int64,2>^ tab_Single;
private:
array<System::Int64>^ tab_First;
System::Void init_Arrays()
{
System::Int64 i;
System::Int64 j;
System::Int64 k;
tab_Bool=gcnew array<System::Boolean,2>(200,200);
tab_Single=gcnew array<System::Int64,2>(200,200);
tab_First=gcnew array<System::Int64>(200*200);
for(i=0;i<200*200;i++)
tab_First[i]=i+1;
k=0;
for(i=0;i<200;i++)
{
for(j=0;j<200;j++)
{
tab_Single[i,j]=tab_First[k];
++k;
}
}
for(i=0;i<200;i++)
{
for(j=0;j<200;j++)
{
k=tab_Single[i,j];
if(is_First(k))
{
tab_Bool[i,j]=true;
}
else
{
tab_Bool[i,j]=false;
}
}
}
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
System::Int64 i;
System::Int64 j;
Graphics^ graph_Panel=panel1->CreateGraphics();
Graphics^ graph_Panel2=panel2->CreateGraphics();
Graphics^ graph_Panel3=panel3->CreateGraphics();
Bitmap^ map_Panel=gcnew Bitmap(panel1->Width,panel1->Height);
Bitmap^ map_Panel2=gcnew Bitmap(panel2->Width,panel2->Height);
Bitmap^ map_Panel3=gcnew Bitmap(panel3->Width,panel3->Height);
Graphics^ graph_Panel4=panel4->CreateGraphics();
Graphics^ graph_Panel5=panel5->CreateGraphics();
Graphics^ graph_Panel6=panel6->CreateGraphics();
Bitmap^ map_Panel4=gcnew Bitmap(panel4->Width,panel1->Height);
Bitmap^ map_Panel5=gcnew Bitmap(panel5->Width,panel2->Height);
Bitmap^ map_Panel6=gcnew Bitmap(panel6->Width,panel3->Height);
System::Drawing::Color color1;
System::Drawing::Color color2;
System::Drawing::Color color3;
System::Drawing::Color color4;
System::Drawing::Color color5;
System::Drawing::Color color6;
color1=System::Drawing::Color::Green;
color2=System::Drawing::Color::Yellow;
color3=System::Drawing::Color::White;
color4=System::Drawing::Color::Black;
color5=System::Drawing::Color::Red;
color6=System::Drawing::Color::Blue;
init_Arrays();
for(i=0;i<200;i++)
{
for(j=0;j<200;j++)
{
if(tab_Bool[i,j])
{
map_Panel->SetPixel(i,j,color2);
map_Panel2->SetPixel(i,j,color4);
map_Panel3->SetPixel(i,j,color6);
map_Panel4->SetPixel(j,i,color1);
map_Panel5->SetPixel(j,i,color3);
map_Panel6->SetPixel(j,i,color5);
}
else
{
map_Panel->SetPixel(i,j,color1);
map_Panel2->SetPixel(i,j,color3);
map_Panel3->SetPixel(i,j,color5);
map_Panel4->SetPixel(j,i,color2);
map_Panel5->SetPixel(j,i,color4);
map_Panel6->SetPixel(j,i,color6);
}
}
}
graph_Panel->DrawImage(dynamic_cast<Image^>(map_Panel),10,10);
graph_Panel2->DrawImage(dynamic_cast<Image^>(map_Panel2),10,10);
graph_Panel3->DrawImage(dynamic_cast<Image^>(map_Panel3),10,10);
graph_Panel4->DrawImage(dynamic_cast<Image^>(map_Panel4),10,10);
graph_Panel5->DrawImage(dynamic_cast<Image^>(map_Panel5),10,10);
graph_Panel6->DrawImage(dynamic_cast<Image^>(map_Panel6),10,10);
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
Close();
}
};
}