title: C++ no suitable constructor exists to convert from
body: <p>We were provided with a template for a program and to finish it, here is our Main.cpp, at line <code>grocery[n++] = Grocery(thisName, no);</code> we think that its trying to concatenate the itemname(thisName) and the number (no) into an array, but we're getting an error, Not really sure how to input two different types of inputs (string + int) into one array to have an output that looks like this:</p>
  
  <pre><code>Grocery List
  Number              Name
  --------------------------------------
   Cheese - Cheddar   1002
   Fish - Cod         1011
   Spinach            2374
   Peppercorns        2953
   Cream              8543
  </code></pre>
  
  <p>Main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstring&gt;
  using namespace std;
  #include "Main.h"
  #include "Grocery.h"
  void sort(Grocery* grocery, int n);
  int main() {
      int no, n = 0;
      Grocery grocery[MAX_GROCERIES];
      cout &lt;&lt; "Grocery List Processor\n";
      cout &lt;&lt; "======================\n";
      do {
          cout &lt;&lt; " Grocery number (0 to quit) ? ";
          cin &gt;&gt; no;
          if (cin.fail() || (cin.get() != '\n')) {
              cin.ignore(2000, '\n');
              cerr &lt;&lt; "Bad character. Try again." &lt;&lt; endl;
              cin.clear();
          }
          else if (no != 0) {
              cout &lt;&lt; " Grocery name ? ";
              char thisName[MAX_LINE_LENGTH + 1];
              cin.getline(thisName, MAX_LINE_LENGTH);
              if (strlen(thisName) &gt; 0)
                      grocery[n++] = Grocery(thisName, no);
  
          }
      } while (no != 0 &amp;&amp; n &lt; MAX_GROCERIES);
      cout &lt;&lt; endl;
      sort(grocery, n);
      cout &lt;&lt; " Grocery List\n\n";
      cout &lt;&lt; " Name Number\n";
      cout &lt;&lt; "------------------------------\n";
      for (int i = 0; i &lt; n; i++) {
          grocery[i].display();
      }
      cout &lt;&lt; endl;
  }
  // sort sorts the elements of Grocery[n] in ascending order
  //
  void sort(Grocery* grocery, int n) {
      int i, j;
      Grocery temp;
      for (i = n - 1; i &gt; 0; i--) {
          for (j = 0; j &lt; i; j++) {
              if (grocery[j].isGreaterThan(grocery[j + 1]))
              {
                  temp = grocery[j];
                  grocery[j] = grocery[j + 1];
                  grocery[j + 1] = temp;
              }
          }
      }
  }
  </code></pre>
  
  <p>grocery.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include "Grocery.h"
  
  
  using namespace std;
  
  void Grocery::display() const{
          char* grocItem = nullptr;
          int prodID = '\0';
  
  }
  void Grocery::display(char *, int){
      grocItem = "";
      prodID = 15;
  
  }
  </code></pre>
  
  <p>EDIT:--------------------------------</p>
  
  <pre><code>Grocery::Grocery(const char *name, const int ID, const int num){
      grocItem = *name;
      prodID = ID;
      numTimes = num;
  
  }
  
  Grocery&amp; Grocery::operator=(const Grocery &amp;rhs){
  
      grocerylist = new char[numTimes];
      for (int i = 0; i &lt; numTimes; i++){
          grocerylist[i] = grocItem + prodID;
      }
      return *this;
  }
  </code></pre>
  
  <p>Here is our assignment operator and our standard overloaded constructor, but Visual studio gives us a weird error:</p>
  
  <pre><code>Error   2   error LNK2019: unresolved external symbol "public: class Grocery &amp; __thiscall Grocery::operator=(class Grocery const &amp;)" (??4Grocery@@QAEAAV0@ABV0@@Z) referenced in function "void __cdecl sort(class Grocery *,int)" (?sort@@YAXPAVGrocery@@H@Z)
  
  
  Error   3   error LNK2019: unresolved external symbol "public: bool __thiscall Grocery::isGreaterThan(class Grocery const &amp;)const " (?isGreaterThan@Grocery@@QBE_NABV1@@Z) referenced in function "void __cdecl sort(class Grocery *,int)" (?sort@@YAXPAVGrocery@@H@Z)  C:\Users\Andrew\Documents\Visual Studio 2013\Projects\Workshop5\Workshop5\Main.obj  Workshop5
  </code></pre>
  
  <p>and a bunch of other weird ones..</p>