Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I get rid of the "Intellisense: no suitable conversion function from "std::string" to "std::string *" exists" error?
    primarykey
    data
    text
    <p>So here's my code,</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int main() { const int NUM_NAMES = 20; string names [NUM_NAMES] = {"Collins, Bill", "Smith, Bart" , "Allen, Jim", "Griffin, Jim", "Stamey, Marty", "Rose, Geri","Taylor, Terri", "Johnson, Jill", "Allison, Jeff", "Looney, Joe" , "Wolfe, Bill", "Rutherford, Greg", "Javens, Renee","Harrison, Rose","Setzer, Cathy", "Pike, Gordon","Holland, Beth"}; string smallest; int minindex; void displayNames (string[NUM_NAMES], int); cout&lt;&lt;"Here are the unalphabetized names"; ****displayNames(names[NUM_NAMES], NUM_NAMES);**** for(int i=0; i &lt; (NUM_NAMES -1); i++) { minindex=i; smallest=names[i]; for(int j = (i+1); j&lt;NUM_NAMES; j++) { if(names[j]&lt;smallest) { smallest = names[j]; minindex = j; } } names[minindex] =names[i]; names[i] = smallest; system("pause"); return 0; } } void displayNames(string names[], int NUM_NAMES) { for (int i =0; i&lt;NUM_NAMES; i ++) { cout&lt;&lt;names[i]&lt;&lt;endl; } } </code></pre> <p>The line bracketed by four asterisks is the line that the error code references when I try to build. The asterisks are NOT there in my actual code. I don't understand how to fix the error </p> <pre><code>Intellisense: no suitable conversion function from "std::string" to "std::string *" exists </code></pre> <p>I've gone through pages and pages of searches, however all the questions/answers appear to refer to a conversion function from <code>string to int</code> or <code>string to char</code> etc. not <code>string to string</code>.</p> <p>On a side note, I do also have to alphabetize these, will what I currently have work? My professor was saying that the computer should evaluate the strings' char values.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload