singly linked chain printing c++

后端 未结 6 590
刺人心
刺人心 2021-01-28 18:39

I am trying to pick my chain in the format {1,2,3,4,etc}. You can find the header file below which will have the layout of the nodes. I am just confused on how I should go about

6条回答
  •  情书的邮戳
    2021-01-28 18:55

    I think I was over thinking it. Anyway here is what I ended up doing. Now I just need to add some formatting for the commas and im all set.

    Node * Temp;
    Temp = new (nothrow) Node;
    Temp = Head;
    out << "{";
    while(Temp->Succ)
    {
          out << Temp->Item;
          Temp = Temp->Succ;
    }
    out << '}' << endl;
    

提交回复
热议问题