Advertisement
AbraaoAllysson

Decodificador- em c

May 5th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. /*int argc, char *argv[]*/
  6.  
  7. void Decimal_para_binario(int saida)
  8. {
  9. int a=saida;
  10. char b[32];
  11.  
  12. itoa(a,b,2);
  13. printf("%s\n",b);
  14. getch();
  15. }
  16.  
  17. void decodificadorPrintf(int *control)
  18. { int saida=1;
  19. int controlS = 16*control[0]+8*control[1]+4*control[2]+2*control[3]+control[4];
  20. saida = saida << controlS;
  21. // printf("%d\n",saida);
  22. Decimal_para_binario(saida);
  23.  
  24. }
  25. int decodificador()
  26. {
  27. return 0;
  28. }
  29.  
  30. int main(void)
  31. {
  32. int control[5];
  33. int i,j,k,w,q;
  34. printf("\n*** CECI *** \n");
  35.  
  36. for(i=0;i<2;i++)
  37. {
  38. for ( j = 0; j < 2; j++)
  39. {
  40. for ( k = 0; k < 2; k++)
  41. {
  42. for ( w = 0; w < 2; w++)
  43. {
  44. for ( q = 0; q < 2; q++)
  45. {
  46. control[0] = i; control[1] = j;
  47. control[2] = k; control[3] = w;
  48. control[4] = q;
  49. //system("PAUSE");
  50. // printf("RAI- %d%d%d%d%d\n",control[0],control[1],control[2],control[3],control[4]);
  51. decodificadorPrintf(control);
  52. // printf("%d%d%d%d%d\n",i,j,k,w,q);
  53.  
  54. }
  55. }
  56. }
  57. }
  58. }
  59.  
  60. /*if(strcmp(control,"00000") == 0)
  61. {
  62. printf("SAIDA 00000000000000000000000000000001\n");
  63. } */
  64.  
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement