Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/11/2011, 07:33
Gott
 
Fecha de Ingreso: febrero-2011
Ubicación: Paraguay
Mensajes: 59
Antigüedad: 13 años, 2 meses
Puntos: 1
Respuesta: Problema pirámide de dígitos

Este codigo lo hice hace algun tiempo..Con algunas modificaciones creo que podras tener lo que buscas.. Un saludo
Código C++:
Ver original
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char* argv[]) {
  7.    int i, j, altura=0, inicio=0;
  8.    
  9.    cout << "Ingrese la altura: ";
  10.    cin >> altura;
  11.    
  12.    for(i=0; i<altura; i++) {
  13.       for(j=0; j<altura*2-1; j++) {
  14.          if(j > altura-i-2 && j < altura+i) {
  15.             cout << "*";
  16.          } else {
  17.             cout << " ";
  18.          }
  19.       }
  20.       cout << endl;
  21.    }
  22.    
  23.    return EXIT_SUCCESS;
  24. }