Nothing to build: Eclipse Issues for C++ -


i have experience java , eclipse, i'm new c++, , trying teach myself. apologize if simple question, or 1 has been asked (though looked around while.) i'm on windows 8.

i'm trying make sorted linked list (which relatively unimportant.) get:

info: nothing build working. 

here's code:

/* *  sortedlist class */ #include <string> #include <fstream> #include<iostream> #include "sortedlist.h"  using namespace std;  //the listnode structure struct listnode {     string data;     listnode *next; };  //the head of linked list , pointer nodes listnode head; listnode *prev, *current;  // insert string list in alphabetical order //now adds string list , counts size of list int insert(string s){ //make new node listnode temp; temp.data = s; //the node traverse list prev = &head; current = head.next; int c = 0; //traverse list, insert string while(current != null){     prev = current;     current = current->next;     c++; }  //insert temp list temp.next = prev->next; prev->next = &temp;  return c; }  //return number of times given string occurs in list. int lookup(string s){ return 0; }  //prints elements of list ostream void print(ostream &output){ }  int main( int argc, char ** argv ) { cout << insert("a") << endl; cout << insert("b") << endl; cout << insert("d") << endl; } 

and here's header:

using namespace std;  #ifndef sortedlist_h_ #define sortedlist_h_  class sortedlist {   public:     // constructor     sortedlist();     // modifiers     int insert(string s);     // other operations     int lookup(string s) const;     void print(ostream &output) const;    private:     struct listnode {        string data;        listnode *next;     };     // pointer first node of list     listnode head;     listnode *prev, *current; }; #endif /* sortedlist_h_ */ 

any appreciated.

why don't use std::deque (in header deque)? has functionality seeking, tested , optimised. if need deque bit more of functionality, create class inherit , add functions need. have http://en.cppreference.com/w/cpp/containe , pick container best suits needs.

as general advise, if need available in , stable library (stl, boost, gsl, armadillo or similar), better use rather write+debug+optimise scratch. general advise, focus efforts on code unique application, , reuse has done (but if has been tested, not use crappy half cooked libraries).


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -