Newsgroup: it.comp.lang.c++
Titolo: Help programma per "Simulazione grafica del lancio dello Shuttle"

Salve, mi chiamo Paolo e sono un neofita del linguaggio C++, ho trovato
degli appunti di mio fratello in cui c'era un esercizio che richiedeva
l'implementazione di un programma in C++ che simulasse graficamente il
lancio di uno Shuttle; la cosa mi ha subito incuriosito e sto provando a
risolverla, ma temo di essere ancora un poco "arruginito". Forse sara' piu'
facile di quello che penso, ma per adesso mi sono incaponito su un
metodo...... adesso vi dico come avrei pensato di risolverlo.
Ho pensato di costruire una matrice con dei valori numerici che saranno poi
trasformati in codice ASCII e una volta messa a video visualizzerà un
fotogramma dell'animazione totale; se cosi' dovesse funzionare posso far
visualizzare tante matrici, ognuna rappresentante un singolo fotogramma....
mi rendo conto che puo' sembrare un po' "arruginita" ..... infatti cosi'
com'e' non va proprio, ma questo penso dipenda da me. Di seguito vi aggiungo
il codice che ho scritto, e mi farebbe molto piacere se poteste darmi
qualche indicazione.
----------------------------------------------------------------------------
---------------------------
#include <iostream.h>
#include <stdlib.h>
const int Height=22;
const int Width=35;
const char A ='\x23';
const char S ='\x20';
const char H ='\x2A';
const char R ='\x5E';
const char r ='\x5F';
const char a ='\x7C';
const char s ='\x3D';
typedef char TCell;
typedef TCell TArea [Height][Width];
int main()
{
  int x,y;
  TArea
one={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,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1,1,0,0,0,0,0,0,0},
{0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0},
{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}};
    for (y=1;y<Height;y++)
     for (x=1;x<Width;x++){
       if (one[y][x]==0)
           one[y][x]= S;
       else if (one[y][x]==1)
           one[y][x]=A;
       else if (one[y][x]==2)
             one[y][x]=H;
       else if (one[y][x]==3)
             one[y][x]=R;
       else if (one[y][x]==4)
              one[y][x]=r;
       else if (one[y][x]==5)
            one[y][x]=a;
       else if (one[y][x]==6)
            one[y][x]=s;
     cout<<one[y][x];};
     cout<<endl;
      system("PAUSE");
      return 0;
}
----------------------------------------------------------------------------
---------------------------
Grazie, e a risentirci sul newsgroup.
Paolo

 visualizzare tante matrici, ognuna rappresentante un singolo
fotogramma....
la scoperta delle animazioni bitmap :))