|
|
|
Помогите разобраться!!!
|
|||
|---|---|---|---|
|
#18+
У меня єсть файл spisok.h class Spisok { struct GenRecord{ float Znach; }; public: void GenRec(); void ShowRec(int,GenRecord msRec); }; //-------------------------------------------- class SecSpisok:public Spisok { int i,k; float j; int Sum; public: void MaxZnach(); }; И есть програма : //--------------------------------------------------------------------------- #include <vcl.h> #include "spisok.h" #include <conio.h> #pragma hdrstop #include "ULab4a.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; SecSpisok*W=new SecSpisok; void Spisok::GenRec() { double k; float lim; //Ств. масив вказівників на струк. GenRecord *listArray[10]; for (int i=0;i<10;i++) //Ств. обєкт для кожного ел. масиву listArray =new GenRecord; int index=0; do { k=double(random(1000))/1000; //k=double(rand())/double(RAND_MAX); listArray[index]->Znach=k; //sizeof (listArray[index]->Znach)-1); index++; } while(index<10); for(int i=0;i<10;i++) {//Здесь Я хочу разименовать масив Указателей (НО НЕВИХОДИТ) W->ShowRec(i,*listArray); } } void Spisok::ShowRec(int i,*listArray)!!!!! Тут ошибка пишет (E2449 Size of 'ShowRec' is unknown or zero [C++ Error] E2238 Multiple declaration for 'Spisok::ShowRec') { GenRecord *listArray[10]; for(i=1;i<11;i++) j= *listArray; } //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender) { StringGrid1->Cells[0][0]=" Ген."; StringGrid1->Cells[1][0]=" Макс"; } //--------------------------------------------------------------------------- void __fastcall TForm1::BGenerClick(TObject *Sender) { W->GenRec(); } //--------------------------------------------------------------------------- void __fastcall TForm1::BShowClick(TObject *Sender) { W->ShowRec(); } //--------------------------------------------------------------------------- Кто может помогите!! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 07.04.2006, 06:15 |
|
||
|
Помогите разобраться!!!
|
|||
|---|---|---|---|
|
#18+
Ошибок тьма. Первая: вместо listArray=new GenRecord; д.быть: for(int i=0; i<10;i++){ listArray =new GenRecord; } Дальше ещё много. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 07.04.2006, 06:29 |
|
||
|
Помогите разобраться!!!
|
|||
|---|---|---|---|
|
#18+
У меня так и єсть: /--------------------------------------------------------------------------- #include <vcl.h> #include "spisok.h" #include <conio.h> #pragma hdrstop #include "ULab4a.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; SecSpisok*W=new SecSpisok; void Spisok::GenRec() { double k; float lim; //Ств. масив вказівників на струк. GenRecord *listArray[10]; for (int i=0;i<10;i++) listArray =new GenRecord; int index=0; do { k=double(random(1000))/1000; //k=double(rand())/double(RAND_MAX); listArray[index]->Znach=k; //sizeof (listArray[index]->Znach)-1); index++; } while(index<10); //GenRecord temp=new *listArray; for(int i=0;i<10;i++) { W->ShowRec(i,*listArray); } } void Spisok::ShowRec(int i,*listArray)!!ПОСМОТРИТЕ ЗДЕСЬ ГДЕ ОШИБКА!! { for(i=1;i<11;i++) j= *listArray; } //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender) { StringGrid1->Cells[0][0]=" Ген."; StringGrid1->Cells[1][0]=" Макс"; } //--------------------------------------------------------------------------- void __fastcall TForm1::BGenerClick(TObject *Sender) { W->GenRec(); } //--------------------------------------------------------------------------- void __fastcall TForm1::BShowClick(TObject *Sender) { //W->ShowRec(); // for(int i=0;i<10;i++){ //W->ShowRec(i,*listArray);} } ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 07.04.2006, 06:47 |
|
||
|
Помогите разобраться!!!
|
|||
|---|---|---|---|
|
#18+
я писалОшибок тьма. Первая: вместо listArray=new GenRecord; д.быть: for(int i=0; i<10;i++){ listArray=new GenRecord; } Дальше ещё много. Конечно, должно быть Код: plaintext Отсюда масса недоразумений ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 07.04.2006, 08:23 |
|
||
|
|

start [/forum/topic.php?fid=57&msg=33650730&tid=2031576]: |
0ms |
get settings: |
11ms |
get forum list: |
15ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
153ms |
get topic data: |
10ms |
get forum data: |
3ms |
get page messages: |
40ms |
get tp. blocked users: |
1ms |
| others: | 249ms |
| total: | 488ms |

| 0 / 0 |
