singly linked chain printing c++

后端 未结 6 495
刺人心
刺人心 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 19:03

    It's hard to get your question. If you want to print the array to screen you should consider writing a display() like:

    #include 
    #include 
    void Set::display() const {
       ostream_iterator out_it (cout," ");
       copy(Pool,Pool+Num,out_it);   
       cout << endl;
    }
    

    or if you want to write to a ostream& (as it is pointed out in the answer by @alestanis)

    #include 
    #include 
    void Set::display(ostream &out) const {
       ostream_iterator out_it (out," ");
       copy(Pool,Pool+Num,out_it);   
       out << endl;
    }
    

提交回复
热议问题