how insert,edit,delete linked list into structure?

hi all
in my program,I have an structue of students with fields name,family,st_no,course,...

and in this structue I must have a linked list for his lessons like:
c++ programming -->database-->MicroController-->NULL

in my program,I must add students and his lessons,and can delete lessons,update lessons ,.....


please help me how can I do that?
At first you can use std::list<Type>
If you have to create your own list here is a sample of list that is a container of TRadioButtons
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
struct dList
{
       dList *Next;
       dList *Prev;
       TRadioButton *TRB;
       };
       
//dList_Shell class implementation
class dList_Shell
{
      private:
              dList *Head;
              dList *Tail;
              dList *Cur;
              int Amount;
      public:
             dList_Shell(TRadioButton *TRB)
             {
                                    Head=new dList;
                                    Head->TRB=TRB;
                                    Head->Next=NULL;
                                    Head->Prev=NULL;
                                    Cur=Head;
                                    Tail=Cur;
                                    Amount=0;
                                    TRB->Checked=true;
                                    };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
             void Add(TRadioButton *TRB)
             {
                  Cur->Prev=Cur;
                  Cur=Cur->Next=new dList;
                  Cur->TRB=TRB;
                  Cur->Next=NULL;
                  Tail=Cur;
                  Amount++;
                  };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
             TRadioButton* GetCur(void)
             {
                           return Cur->TRB;
                           };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
             TRadioButton* GetTail(void)
             {
                           return Tail->TRB;
                           };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
             TRadioButton* GetHead(void)
             {
                           return Head->TRB;
                           };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

             void Delete(TRadioButton *TRB)
             {
                  dList *Current=new dList;
                  Current=Head;
                  while(Current->TRB!=TRB)
                  {
                                          Current=Current->Next;
                                          }
                  delete Current->TRB;
                  Current->Prev->Next=Current->Next;
                  };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
             TRadioButton* GetByIndex(int i)
             {
                           int k=0;
                           dList *Current=Head;
                           if(i>=Amount) return Tail->TRB;
                           if(i<=0) return Head->TRB;
                           
                           while(k<i)
                           {
                                      Current=Current->Next;
                                      k++;
                                      }
                                      return Current->TRB;
                                      };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
             TRadioButton* GetByName(String S)
             {
                           dList *Current;
                           Current=Head;
                           while(Current->TRB->Caption!=S)
                           {
                                                          Current=Current->Next;
                                                          };
                                                          return Current->TRB;
                                                          };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
             TRadioButton* GetChecked(void)
             {
                           dList *Current;
                           Current=Head;
                           while(!Current->TRB->Checked)
                           {
                                                        Current=Current->Next;
                                                        }
                                                        return Current->TRB;
                                                        };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
             int GetAmount(void)
             {
             return Amount;
             };
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
Topic archived. No new replies allowed.