struct Polinom int coef int int int Polinom next void __fastcall TForm

 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
struct Polinom
{
int coef;
int x;
int y;
int z;
Polinom* next;
};
void __fastcall TForm2::BitBtn1Click(TObject *Sender)
{
string str;
Polinom *pointer, head;
pointer=&head;
str= (Edit1->Text).c_str();
int in=0;
int coef=0;
int x=0,y=0,z=0;
while(sscanf(str.c_str(),"%d*x^%d*y^%d*z^%d",&coef,&x,&y,&z))
{
pointer->next = new Polinom;
pointer=pointer->next;
pointer->x=x;
pointer->y=y;
pointer->z=z;
pointer->coef=coef;
str.erase(0,(str.find('+')>str.find('-'))?str.find('-'):str.find('+'));
//ShowMessage(IntToStr(pointer->x));
}