Result:
private: System::Void init_Random()
{
srand(time(NULL));
}
private: System::Char my_Lowercase()
{
int x,j=1;;
char i;
x=rand()%26;
i='a';
for(j=0;j<=x-1;j++)
{
i++;
}
return i;
}
private: System::Char my_Uppercase()
{
int x,j=1;
char i;
i='A';
x=rand()%26;
for(j=0;j<=x-1;j++)
{
i++;
}
return i;
}
private: System::Char case_ListBox()
{
int i;
i=rand()%2;
if(i==1)
return my_Uppercase();
else
return my_Lowercase();
}
private: System::Int16 my_Number()
{
int x;
x=rand()%10;
return x;
}
private: System::String^ symbol_ListBox()
{
int i;
i=rand()%2;
if(i==1)
return case_ListBox().ToString();
else
return my_Number().ToString();
}
private: System::Void clear_ListBoxes()
{
listBox1->Items->Clear();
listBox2->Items->Clear();
listBox3->Items->Clear();
listBox4->Items->Clear();
listBox5->Items->Clear();
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Close();
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
init_Random();
timer1->Start();
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
int i;
int j,how_many;
how_many=Convert::ToInt16(textBox1->Text);
array <System::String^>^ my_string=gcnew array<System::String^>(how_many);
clear_ListBoxes();
for(i=0;i<how_many;i++)
{
listBox1->Items->Add(case_ListBox().ToString());
listBox2->Items->Add(symbol_ListBox());
listBox3->Items->Add(case_ListBox().ToString());
listBox4->Items->Add(symbol_ListBox());
my_string[i]=listBox1->Items[i]->ToString()+listBox2->Items[i]->ToString()+listBox3->Items[i]->ToString()+listBox4->Items[i]->ToString()+".txt";
listBox5->Items->Add(my_string[i]);
}
i=0;
do
{
StreamWriter^ my_stream = gcnew StreamWriter(my_string[i]);
my_stream->Write(label7->Text);
my_stream->Close();
i++;
}while(i<how_many);
}
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
DateTime my_time=DateTime::Now;
label7->Text=" time "+my_time.Hour.ToString("D2")+":"+my_time.Minute.ToString("D2")+":"+my_time.Second.ToString()+
" date "+my_time.Day.ToString()+"-"+my_time.Month.ToString()+"-"+my_time.Year.ToString();
}
private: System::Void Form1_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) {
timer1->Stop();
}
};
}
Brak komentarzy:
Prześlij komentarz