0
#include <iostream>
#include <conio.h>
using namespace std;

class nodes
{
    public:
    int data;
    nodes *next;
    
        void getdata(void)
        {
            cout<<"Enter data:";cin>>data;
        }
        void putdata(void)
        {
            cout<<"\n Data:"<<data;
        }
        *nodes return_next()
        {
            return next;
        }
};

nodes *start = new nodes;
int main()
{   
    nodes  temp, n = start;
   // int a=5;
   // cout<<"HOW MUCH NODES YOU WANT:";cin>>a;
    cout<<"ENTER DATA TO THE LIST";
    for(int i=0; i<5; i++)
    {
        cout<<"Enter data to node ["<<i<<"] :";
        n.getdata();
        n = n.return_next();
    }

    n = start;
    cout<<"PRINTING DATA:"
    for(int i=0; i<5; i++)
    {
        cout<<"["<<i<<"] :"<<n.putdata();
        n = n.return_next();
    }

    n=start;
    for(int i=0; i<5; i++)
    {
        temp = n.return_next();
        delete n;
        n = temp;
    }
    return 0;
}

The errors are syntactical and of type conversions. please help.

Im learning C++ again after a long time, im currently finding things difficult that was previously a piece of cake, Please share your favorite source for learning cpp, it will be very usefull for me. Thanks in advance!

  • *"Please share your favorite source for learning cpp"* Here it is: [good C++ book](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). – Jason Aug 20 '22 at 17:17
  • Btw for you future posts, you should also post the errors that you're getting in your question. – Jason Aug 20 '22 at 17:19
  • ` *nodes return_next()` does it compile? – macroland Aug 20 '22 at 17:21

0 Answers0