Foro de elhacker.net

Programaci๓n => Programaci๓n C/C++ => Mensaje iniciado por: mapers en 7 Marzo 2011, 23:31 pm



Título: Interfaz Grafica
Publicado por: mapers en 7 Marzo 2011, 23:31 pm
buenas se๑ores del foro tengo una duda como podria  aplicarle a mi programa una interfaz  grafica .......me refiero a que se vea en ventanas y no en consola ........estoy trabajando ocn DEV C++ bajo windows este es mi programa
Código
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<windows.h>
  4. #include <cstdlib> //tiene la definicion de la funcion RAND (random)
  5.  
  6. int main ()
  7. {
  8.    system("color a");
  9. int arreglo[20],k=0,numero=1,bandera=0,matriz[20][20],elementos_arreglo=0,cantidad_arreglo=0,n1=0,m=0;  
  10. cout<<"\t\t ศออออออออออออออออออออออออออออออออออออออออออผ\n";  
  11. cout<<"\t\t บ Ingrese Elementos de los Arreglos "<<endl;  
  12. cout<<"\t\t ศออออออออออออออออออออออออออออออออออออออออออผ\n";
  13. cin>>elementos_arreglo;  
  14. cout<<"\t\t ศออออออออออออออออออออออออออออออออออออออออออผ\n";  
  15. cout<<"\t\t บ Ingrese la cantidad de Arreglos "<<endl;  
  16. cout<<"\t\t ศออออออออออออออออออออออออออออออออออออออออออผ\n";
  17. cin>>cantidad_arreglo;  
  18. cout<<"\t\t ศออออออออออออออออออออออออออออออออออออออออออผ\n";  
  19. cout<<"\t\t  La Matriz a Transferir es de  "<<"["<<elementos_arreglo<<" ] ["<<cantidad_arreglo<<"] "<<endl;  
  20. cout<<"\t\t ศออออออออออออออออออออออออออออออออออออออออออผ\n";
  21. while(bandera!= cantidad_arreglo)
  22. {
  23.                cout<<" Arreglo Numero  "<< numero<<endl;
  24.  
  25.                for(int i=0;i<elementos_arreglo;i++)
  26.                {                
  27.                  //cout<<"ingrese elemento"<<i+1<<"  "<<endl;    
  28.                  arreglo[i]=(1 + rand() % 20);        
  29.                  }
  30.                  cout<<"Los elementos del arreglo son "<<endl;        
  31.                  getch();
  32.                  for(int j=0;j<elementos_arreglo;j++)
  33.                  {       system("color c");
  34.                           cout<<"<<"<<arreglo[j]<<">>";  
  35.                  }
  36.                  cout<<endl;
  37.                  //for(int m=m1;m<elementos_arreglo;m++)
  38.                           for(int n=0;n<elementos_arreglo;n++)
  39.                            { matriz[m][n]=arreglo[n];
  40.                            }
  41.                             m++;
  42.                  //cout<<"Desea continuar agregando elemntos en el segundo Arreglo"<<endl;
  43.                  //cout<<"Presione 1 para imprmir la matriz "<<endl;
  44.                  //cout<<"Presione cualquier otro numero para continuar en el siguiente arreglo"<<endl;
  45.                  //cin>>bandera;
  46.  
  47.                            numero++;
  48.                            bandera++;
  49.  
  50.  
  51. }
  52.                            system("color e");
  53.                            cout<<"\t\t ศออออออออออออออออออออออออออออออออออออออออออผ\n";
  54.                            cout<<"\t\tImprimir la Matriz"<<endl;
  55.                            cout<<"\t\t ศออออออออออออออออออออออออออออออออออออออออออผ\n";
  56.                            getch();
  57.                            for(int t=0;t<numero-1;t++)
  58.                                     { for(int y=0;y<elementos_arreglo;y++)
  59.  
  60.                                               cout<<matriz[t][y]<<"\t";
  61.                                               cout<<endl;
  62.                                               Sleep(200);
  63.                                     }        
  64. cout<<endl;                      
  65. system("pause");
  66.  
  67. }
  68.  
  69.  


a ver si me dan una manita


Título: Re: Interfaz Grafica
Publicado por: mauriciodelos en 8 Marzo 2011, 02:42 am
Es bastante complejo pero pod้s empezar por acแ:
http://winapi.conclase.net/ (http://winapi.conclase.net/)

Esa es la de windows pero tambi้n hay otras interfaces como allegro o sdl.

si pod้s, tratแ de no desistir  ;D  .

De a poquito. Igualmente recordแ que el c๓digo limpio en consola es mas fแcil de portar a otros S.O.


Título: Re: Interfaz Grafica
Publicado por: mapers en 8 Marzo 2011, 03:44 am
se ve bastante tedioso "!"!"!"! no se podria hacer algo como se hace en java un editor


Título: Re: Interfaz Grafica
Publicado por: Oblivi0n en 8 Marzo 2011, 16:02 pm
Visual studio tiene un creador de GUI's, Dev-C++ tiene una version con wxWidgets, creo que  con code::blocks tambien se pueden crear interfaces, lo que te ha pasado es para crear interfaces con WinAPI, no hay ningun editor, de todos modos, por el modo en el que programas, creo que te vendria mejor dominar c++, y luego meterte con interfaces, me parece mas importante dominar el lenguaje que intentar crear una interfaz

Saludos