#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!