struct Line int int value Line next struct Matrix int Line value Matri

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
struct Line
{ int j;
int value;
Line* next;
} ;
struct Matrix
{ int i;
Line* value;
Matrix* next;
} ;
void __fastcall TForm1::BitBtn5Click(TObject *Sender)
{
AnsiString s1;
Line head, *pointer;
Matrix head2, *pointer2;
int i,j;
pointer=&head;
pointer2=&head2;
for (i=0;i<1000;i++)
{
if (StringGrid1->Rows[i]!="")
{ pointer2->next= new Matrix;
pointer2=pointer2->next;
pointer2->i=i;
pointer2->value=pointer;
pointer2->next=NULL;
for (j=0;j<1000;j++)
{
if (StringGrid1->Cells[j][i]!="")
{
pointer->next= new Line;
pointer=pointer->next;
pointer->value= StrToInt(StringGrid1->Cells[j][i]);
pointer->j=j;
pointer->next=NULL;
}
}
}
}
while (pointer2!=NULL)
{
s1+= IntToStr(pointer2->i)+",";
pointer2=pointer2->next;
}
ShowMessage(s1);
}