.


:




:

































 

 

 

 





, , .

#include <iostream>

#include <conio.h>

using namespace std;

// " "

struct cell2

{ char sign[10];

int weight;

cell2 *pc1;

cell2 *pc2;

};

cell2 *end; //

//

cell2 *f_input(cell2 *r)

{ //

cell2 *p = new cell2;

//

cout << "sign = ";

cin >> p->sign;

cout << "weight = ";

cin >> p->weight;

if(p->weight == 0)

{ delete [] p;

end = r; //

return NULL;

}

p->pc1 = r;

p->pc2 = f_input(p); // ,

//

return p; //

}

//

void f_output(cell2 *p)

{ if(p == NULL)

{ cout << "\nEnd of listing!"; //

return;

}

cout << "\nsign = " << p->sign

<< "\tweight = " << p->weight;

f_output(p->pc2); //

}

void main()

{ cell2 *beg = NULL; //

cout << "Input value struct\n"; //

beg = f_input(beg); //

cout << "\nContent of list"; //

f_output(beg);

 

getch();

}

. . struct cell, , struct cell2.

struct cell * input(struct cell2 * r);

. ( ). - . .

void output(struct cell2 *p). : struct cell2 p -> 2 (p -> .

beg end, . . : , . end output() . end ( ). output() end ( ) . main, .

.

 

1. , .

2. (. /3/).

3. .

4. .

 

1. ( , , , ).

2. .

3. .

4. .

5. .

6. .

7. .

 

1. .., .. : . . 2- . . .: , 1999. 600 .: .

2. .., .. : . .- .: . ., 1987.- 248 .: .

3. .. ( ).

 





:


: 2016-12-18; !; : 638 |


:

:

, .
==> ...

1748 - | 1501 -


© 2015-2024 lektsii.org - -

: 0.013 .