Ver Mensaje Individual
  #1  
Antiguo 06-03-2009
torrescrack9 torrescrack9 is offline
Registrado
 
Registrado: feb 2009
Posts: 5
Reputación: 0
torrescrack9 Va por buen camino
duda juego c++ builder 2007

Estoy haciendo el juego de simon dice en c++ builder 2007 y tengo la siguiente duda debo dimensionar un vector y he probado de un monton de formas y no soi capaz me da un error....

Mira pongo el codigo aver si alguien sabe a q se debe el error...

Lo que kiero es dimensionar las variables vector y vectorentrada

El error que me sale es el siguiente:

Cita:
---structure required on left side of. or .

--- invalid direction
Código:
#include <vcl.h>
#pragma hdrstop
#include "Unit2.h"
int repeticiones;
int contador;
short vector;
short vectorentrada;
int i;
const short limiteinf=1;
const short limitesup=4;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
void colores_iniciales()
 {
  Form2->I_1->Picture=Form2->I_gris1->Picture;
  Form2->I_2->Picture=Form2->I_gris2->Picture;
  Form2->I_3->Picture=Form2->I_gris3->Picture;
  Form2->I_4->Picture=Form2->I_gris4->Picture;
 }
void aleatorio(short limiteinf,short limitesup)
 {
  short aleatorio=0;
  Randomize();
  aleatorio=Int((limitesup-limiteinf+1)*Random()+limiteinf);
 }
void inicio()
{
 //int i;
 vector.redim(repeticiones);
 vectorentrada.redim(repeticiones);
 for(i=1;i<repeticiones;i++)
 {
  vector[i] = aleatorio(limiteinf,limitesup);
 }
 Form2->I_1->Enabled=false;
 Form2->I_2->Enabled=false;
 Form2->I_3->Enabled=false;
 Form2->I_4->Enabled=false;
 Form2->Juego1->Enabled=false;
 Form2->Acerca1->Enabled=false;
 Form2->Secuenciador->Enabled=true;
 contador=1;
}
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
 : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormShow(TObject *Sender)
{
colores_iniciales();
repeticiones=1;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Nuevo1Click(TObject *Sender)
{
inicio();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::SecuenciadorTimer(TObject *Sender)
{
colores_iniciales();
if(contador<=repeticiones)
 {
  L_Contador->Caption=contador;
  switch((vector[contador]))
   {
    case 1:
      I_1->Picture=I_rojo->Picture;
      break;
    case 2:
      I_2->Picture=I_azul->Picture;
      break;
    case 3:
      I_3->Picture=I_Amarillo->Picture;
      break;
    case 4:
      I_4->Picture=I_Verde->Picture;
      break;
   }   // fin switch;
   contador=contador+1;
  }
else  {
   L_Contador->Caption="";
   contador=1;
   Secuenciador->Enabled=false;
   I_1->Enabled=true;
   I_2->Enabled=true;
   I_3->Enabled=true;
   I_4->Enabled=true;
  }
}
//---------------------------------------------------------------------------
void __fastcall TForm2::BorradorTimer(TObject *Sender)
{
colores_iniciales();
Borrador->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Salir1Click(TObject *Sender)
{
Form2->Close();
}
//---------------------------------------------------------------------------

Última edición por dec fecha: 06-03-2009 a las 14:55:39. Razón: Poner las etiquetas QUOTE y CODE
Responder Con Cita