Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/06/2012, 04:55
oldesebas
 
Fecha de Ingreso: mayo-2012
Mensajes: 7
Antigüedad: 12 años
Puntos: 0
Error - Vector de caracteres [Principiante]

No entiendo cual es el problema:

Código C++:
Ver original
  1. #include <stdio.h>
  2.  
  3. /* BLANCO -> 0 ' ' ; 1 '.' ; 2 ':' ; 3 '¡' ; 4 'i' ; 5 'I' ; 6 'H' ; 7 '#'  <- NEGRO */
  4.  
  5. const int Ancho  = 40;
  6. const int Alto   = 40;
  7. const int Blanco =  0;
  8. const int Negro  =  7;
  9.  
  10. typedef int TipoPixel;
  11.  
  12.  
  13.  
  14. typedef TipoPixel TipoImagen[Alto][Ancho];
  15.  
  16. void LeerImagen(TipoImagen imagen){
  17.     char x;
  18.  
  19.     for (int f = 0; f < Alto; f++){
  20.         for (int c = 0; c < Ancho; c++){
  21.  
  22.             scanf("%c", &x);
  23.             imagen[f][c] = int(x);
  24.         }
  25.     }
  26. }
  27.  
  28. void ContrastarImagen(TipoImagen imagen, int nivel){
  29.  
  30.     for (int f = 0; f < Alto; f++){
  31.         for (int c = 0; c < Ancho; c++){
  32.             if(imagen[f][c] <= nivel){
  33.                 imagen[f][c] = Blanco;
  34.             }else{
  35.                 imagen[f][c] = Negro;
  36.             }
  37.         }
  38.     }
  39. }
  40.  
  41. void ImprimirImagen(const TipoImagen imagen){
  42.  
  43.     typedef char TipoColor[8];                                            (ERROR*)
  44.     TipoColor Color = {' ','.',':','¡','i','I','H','#'};                            
  45.  
  46.     for(int f = 0; f < Alto; f++){
  47.         for(int c = 0; c < Ancho; c++){
  48.             printf("%c", Color[imagen[f][c]]);
  49.         }
  50.         printf("\n");
  51.     }
  52. }
  53.  
  54. int main(){
  55.  
  56.     TipoImagen imagen;
  57.  
  58.     LeerImagen(imagen);
  59.     printf("Imagen inicial:\n\n");
  60.     ImprimirImagen(imagen);
  61.  
  62.     ContrastarImagen(imagen, 4);
  63.     printf("\n\nImagen Contrastada:\n\n");
  64.     ImprimirImagen(imagen);
  65.  
  66.     return 0;
  67. }

ERROR:

aviso: constante de carácter con múltiples caracteres [-Wmultichar]|
aviso: desbordamiento en la conversión implícita de constante [-Woverflow]|

||=== Build finished: 2 errors, 0 warnings ===||


Agradezco cualquier ayuda. ;)