Bienvenido: Ingresar
location: attachment:U11-operadores-1.c de claudiojpaz/InformaticaI_2019

Adjunto 'U11-operadores-1.c'

Descargar

   1 #include <stdio.h>
   2 
   3 union char2bits {
   4   char byte;
   5   struct {
   6     unsigned char b0:1;
   7     unsigned char b1:1;
   8     unsigned char b2:1;
   9     unsigned char b3:1;
  10     unsigned char b4:1;
  11     unsigned char b5:1;
  12     unsigned char b6:1;
  13     unsigned char b7:1;
  14   } bits;
  15 };
  16 
  17 void imprimir_bits (char b);
  18 void imprimir_raya (char size);
  19 
  20 int main (void)
  21 {
  22 
  23   char a = 77;
  24   char b = 42;
  25   char c;
  26 
  27   printf("ADN\n");
  28   c = a & b;
  29   imprimir_bits(a);
  30   imprimir_bits(b);
  31   imprimir_raya(15);
  32   imprimir_bits(c);
  33 
  34   printf("\nOR\n");
  35   c = a | b;
  36   imprimir_bits(a);
  37   imprimir_bits(b);
  38   imprimir_raya(15);
  39   imprimir_bits(c);
  40 
  41   printf("\nXOR\n");
  42   c = a ^ b;
  43   imprimir_bits(a);
  44   imprimir_bits(b);
  45   imprimir_raya(15);
  46   imprimir_bits(c);
  47   printf("\nCOMPLEMENTO\n");
  48 
  49   c = ~a;
  50   imprimir_bits(a);
  51   imprimir_raya(15);
  52   imprimir_bits(c);
  53 
  54   printf("\nCORRIMIENTO Izq\n");
  55   c = 5 << 1;
  56   imprimir_bits(5);
  57   imprimir_raya(15);
  58   imprimir_bits(c);
  59 
  60   printf("\nCORRIMIENTO Der\n");
  61   c = 10 >> 1;
  62   imprimir_bits(10);
  63   imprimir_raya(15);
  64   imprimir_bits(c);
  65 
  66   printf("\nCORRIMIENTO 9 bits\n");
  67   c = 5 << 9;
  68   imprimir_bits(5);
  69   imprimir_raya(15);
  70   imprimir_bits(c);
  71 
  72   printf("\nCORRIMIENTO de Negativo\n");
  73   c = -128 >> 4;
  74   imprimir_bits(-128);
  75   imprimir_raya(15);
  76   imprimir_bits(c);
  77 
  78   return 0;
  79 }
  80 
  81 void imprimir_bits (char b)
  82 {
  83   union char2bits c2b;
  84 
  85   c2b.byte = b;
  86 
  87   printf("%d %d %d %d %d %d %d %d\n", c2b.bits.b7,c2b.bits.b6,c2b.bits.b5,c2b.bits.b4,
  88                                       c2b.bits.b3,c2b.bits.b2,c2b.bits.b1,c2b.bits.b0);
  89 }
  90 
  91 void imprimir_raya (char size)
  92 {
  93   for (int i = 0; i < size; i++ )
  94     printf("-");
  95 
  96   printf("\n");
  97 
  98 }

Archivos adjuntos

Para referirse a los adjuntos de una página, usa attachment:nombredelarchivo, como se muestra abajo en la lista de archivos. NO uses la URL del enlace [get], ya que puede cambiar fácilmente y dejar de funcionar.
  • [obtener | ver] (2019-11-04 17:34:35, 30.3 KB) [[attachment:EasyPIO.h]]
  • [obtener | ver] (2019-03-19 22:08:01, 706.6 KB) [[attachment:U0.pdf]]
  • [obtener | ver] (2019-03-26 21:56:21, 13494.4 KB) [[attachment:U1-full.pdf]]
  • [obtener | ver] (2019-03-26 21:55:42, 11327.7 KB) [[attachment:U1-parte-1.pdf]]
  • [obtener | ver] (2019-03-26 21:55:58, 2196.6 KB) [[attachment:U1-parte-2.pdf]]
  • [obtener | ver] (2019-10-21 17:31:24, 2.5 KB) [[attachment:U10-binarios.zip]]
  • [obtener | ver] (2019-10-28 18:41:00, 0.4 KB) [[attachment:U10-parametros.c]]
  • [obtener | ver] (2019-10-11 03:40:01, 2055.6 KB) [[attachment:U10-parte-1.pdf]]
  • [obtener | ver] (2019-10-21 13:35:03, 1252.7 KB) [[attachment:U10-parte-2.pdf]]
  • [obtener | ver] (2019-10-28 18:39:42, 0.6 KB) [[attachment:U11-operadores-0.c]]
  • [obtener | ver] (2019-10-28 18:40:00, 1.6 KB) [[attachment:U11-operadores-1.c]]
  • [obtener | ver] (2019-10-28 18:40:48, 0.2 KB) [[attachment:U11-operadores-2.c]]
  • [obtener | ver] (2019-10-28 18:38:30, 1095.1 KB) [[attachment:U11-parte-1.pdf]]
  • [obtener | ver] (2019-04-15 18:22:50, 603.8 KB) [[attachment:U2-full.pdf]]
  • [obtener | ver] (2019-04-03 19:05:57, 245.1 KB) [[attachment:U2-parte-1.pdf]]
  • [obtener | ver] (2019-04-08 21:20:40, 220.5 KB) [[attachment:U2-parte-2.pdf]]
  • [obtener | ver] (2019-04-15 18:22:30, 207.6 KB) [[attachment:U2-parte-3.pdf]]
  • [obtener | ver] (2019-05-08 02:00:33, 942.4 KB) [[attachment:U3-full.pdf]]
  • [obtener | ver] (2019-04-15 18:25:42, 256.9 KB) [[attachment:U3-parte-1.pdf]]
  • [obtener | ver] (2019-04-22 17:26:43, 237.8 KB) [[attachment:U3-parte-2.pdf]]
  • [obtener | ver] (2019-04-30 13:32:10, 464.1 KB) [[attachment:U3-parte-3.pdf]]
  • [obtener | ver] (2019-05-08 02:00:10, 145.7 KB) [[attachment:U3-parte-4.pdf]]
  • [obtener | ver] (2019-05-22 13:32:13, 241.0 KB) [[attachment:U4-full.pdf]]
  • [obtener | ver] (2019-05-14 13:04:35, 208.3 KB) [[attachment:U4-parte-1.pdf]]
  • [obtener | ver] (2019-05-22 13:31:58, 76.9 KB) [[attachment:U4-parte-2.pdf]]
  • [obtener | ver] (2019-06-11 14:33:15, 482.5 KB) [[attachment:U5-full.pdf]]
  • [obtener | ver] (2019-05-30 18:33:24, 142.3 KB) [[attachment:U5-parte-1.pdf]]
  • [obtener | ver] (2019-06-06 13:54:22, 177.1 KB) [[attachment:U5-parte-2.pdf]]
  • [obtener | ver] (2019-06-11 14:33:01, 250.1 KB) [[attachment:U5-parte-3.pdf]]
  • [obtener | ver] (2019-06-28 13:48:56, 303.3 KB) [[attachment:U6-full.pdf]]
  • [obtener | ver] (2019-08-02 19:14:39, 170.3 KB) [[attachment:U7-parte-1.pdf]]
  • [obtener | ver] (2019-10-03 17:28:08, 1695.9 KB) [[attachment:U9-parte-1.pdf]]
  • [obtener | ver] (2019-10-03 17:28:24, 1156.9 KB) [[attachment:U9-parte-2.pdf]]
  • [obtener | ver] (2019-10-03 18:05:22, 259.2 KB) [[attachment:U9-parte-3.pdf]]
  • [obtener | ver] (2019-10-11 03:25:15, 1774.5 KB) [[attachment:U9-parte-4.pdf]]
  • [obtener | ver] (2019-05-22 13:32:34, 0.7 KB) [[attachment:algoritmos.zip]]
  • [obtener | ver] (2019-07-01 11:04:29, 39.1 KB) [[attachment:guia-arreglos-1.pdf]]
  • [obtener | ver] (2019-04-30 13:32:36, 2.8 KB) [[attachment:source-2.zip]]
  • [obtener | ver] (2019-05-08 02:00:45, 1.9 KB) [[attachment:source-3.zip]]
  • [obtener | ver] (2019-04-22 20:53:50, 1.1 KB) [[attachment:source.zip]]
 All files | Selected Files: delete move to page copy to page

No tienes permisos para adjuntar un archivo a esta página.