Jump to content
Fórum Script Brasil
  • 0

CONERSOR DE DECIMAL PARA BINÁRIO


roccoC/C++

Question

1 answer to this question

Recommended Posts

  • 0

Olá roccoC/C++,

Já que é só pra apreciação segue minha proposta.

Abs


#include <stdio.h>
#include <dos.h>
#include <stdlib.h>

void main(void)
{
struct
{
unsigned char bit0 : 1;
unsigned char bit1 : 1;
unsigned char bit2 : 1;
unsigned char bit3 : 1;
unsigned char bit4 : 1;
unsigned char bit5 : 1;
unsigned char bit6 : 1;
unsigned char bit7 : 1;
} unsigned binario;

printf("Digite um numero:\n");
scanf("%d", &binario);
printf("Binario: %d%d%d%d-%d%d%d%d\n", binario.bit7, binario.bit6, binario.bit5, binario.bit4,
binario.bit3, binario.bit2, binario.bit1, binario.bit0);
system("pause");
}
[/codebox]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652.1k
×
×
  • Create New...