Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void decToBin(void){
- double b=Form1->Display->Text.ToDouble();
- int x=b;
- int temp=0;
- int t[32];
- if (!x) return;
- if (x<0) {
- x=-x;
- znak=true;
- } else znak=false;
- for (int i = 0; i < (sizeof(x)*8); ++i) {
- temp=((x>> i) & 1);
- t[i]=temp;
- }
- Form1->Display->Clear();
- if (znak==true) Form1->Display->Text="-";
- for (int i=sizeof(x)*8-1; i>=0; i--) {
- if (t[i]==2) exit;
- else Form1->Display->Text=Form1->Display->Text+t[i];
- Form1->Display->Paragraph->Alignment=taRightJustify;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement