poniedziałek, 13 listopada 2017

Example type Binary (Visual C++)



#pragma endregion
private: System::String^ text_Binary(char value)
{
unsigned char test_bin[11]={1,2,4,8,16,32,64,128,256,512,1024};
String^ text;
text="";
System::Int16 bytes;
System::Int16 i;
for(i=10;i>=0;i--)
{
bytes=(test_bin[i]&value);
if(bytes!=0)
text+="1";
else
text+="0";
}
return text;
}
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
}
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
System::Int16 i;
System::Int16 j;
System::Int16 k;
for(i=0;i<1024;i++)
{
listBox1->Items->Add(text_Binary(i));
listBox2->Items->Add(text_Binary(~i));
listBox3->Items->Add(text_Binary(i<<1));
}

Brak komentarzy:

Prześlij komentarz