I create a linked lists and get three errors:
here is my code:Code:Error E2176 C:\linkedlist.cpp 10: Too many types in declaration Error E2111 C:\linkedlist.cpp 11: Type 'linkedlist' may not be defined here Error E2034 C:\linkedlist.cpp 27: Cannot convert 'int' to 'linkedlist' in function main()
Code:#include<iostream> #include<string> #include<conio> using namespace std; struct linkedlist { string key; linkedlist *next; } int main() { linkedlist *first = NULL, *second = NULL, *third = NULL, *fourth = NULL; first = new linkedlist; first->key = "Hello, "; second = new linkedlist; first->next = second; second->key="my "; third = new linkedlist; second->next=third; third->key="name's"; fourth = new linkedlist; fourth->key=" Joe!"; fourth->next=NULL; cout<<first->key<<second->key<<third->key<<fourth->key; cout.flush(); getch(); return 0; }



LinkBack URL
About LinkBacks


