一个C++builder程序问题多多,但不知错在哪里啊!!

来源:百度知道 编辑:UC知道 时间:2024/06/05 21:15:06
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
class fly_shape{
private :
int x;int y;int speed;int status;TShape *obj;
public:
fly_shape(TComponent*AOwner,int x1,int y1,int sp):x(x1),
y(y1),speed(sp)
{
obj=new TShape(AOwner);
obj->Left=x;
obj->Top=y;
obj->Width=30;
obj->Height=30;
if(sp>30)
{
obj->Brush->Color=clPurple;
}

你这个程序的语法完全错了,我给你改了一下
BCB不支持内部类的,所以不能在一个过程里声明类
而且for语句的结构也不对

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}

class fly_shape
{
private :
int x;
int y;
int speed;
int status;
TShape *obj;
public:
fly_shape(TComponent*AOwner,int x1,int y1,int sp):x(x1),y(y1),speed(sp)
{
obj=new TShape(AOwner);
obj->Left=x;