#include <stdio.h>
Go to the source code of this file.
|
| int | main (int argc, char *argv[]) |
◆ BIT
◆ BIT_CLEAR
| #define BIT_CLEAR |
( |
| x, |
|
|
| n ) |
◆ BIT_GET
◆ BIT_SET
◆ BIT_TOGGLE
| #define BIT_TOGGLE |
( |
| x, |
|
|
| n ) |
◆ BIT_WRITE
| #define BIT_WRITE |
( |
| x, |
|
|
| n, |
|
|
| v ) |
◆ main()
| int main |
( |
int | argc, |
|
|
char * | argv[] ) |
Definition at line 10 of file 026_Binarios.c.
11{
12 int i, n, nb;
13 int xi;
14 char x, xb;
15 printf("x = ");
16 scanf("%d", &xi);
17 x = (char)xi;
18 n = 8*sizeof(x);
19 for(i=n; i>0; i--)
20 printf(
"%d",
BIT_GET(x,i-1)?1:0);
21 printf("\n");
22 do{
23 printf("Ingrese el numero de bit: ");
24 scanf("%d", &nb);
25 }while(nb<-1|nb>=n);
27 do{
28 printf("Ingrese el numero de bit: ");
29 scanf("%d", &nb);
30 }while(nb<-1|nb>=n);
32 do{
33 printf("Ingrese el numero de bit: ");
34 scanf("%d", &nb);
35 }while(nb<-1|nb>=n);
37 do{
38 printf("Ingrese el numero de bit: ");
39 scanf("%d", &nb);
40 }while(nb<-1|nb>=n);
41 printf("Ingrese el valor del bit: ");
42 scanf("%d", &xi);
43 xb = (char)xi;
45 return 0;
46}
#define BIT_WRITE(x, n, v)