Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ Strange error, "no conversion from 'int' to 'int (__cdecl *)(float,float)'"
    primarykey
    data
    text
    <p>First of all this is my first question on stackoverflow. I'm trying to complete a homework assignment but I don't know what I might be doing wrong.</p> <p>I get an error, "no conversion from 'int' to 'int (__cdecl *)(float,float)'" when I try to run a function for the second time. The function is supposed to return either 0, -1, or +1, and that's used in a if/else statement.</p> <p>Here's the chunk of code I'm referring to...</p> <pre><code> #include &lt;iostream&gt; using namespace std; ////this function returns a -1 if the left pan has a weight more than the right, a 0 if the weights of the two pans are equal, and a +1 if the right pan has a greater weight than the left int weigh(float leftpan, float rightpan) { //compare the pan weights, return value } float findOddRock(float r1, float r2, float r3, float r4, float r5, float r6, float r7) { //first weigh float first_leftpan = r1 + r2; float first_rightpan = r3 + r4; weigh(first_leftpan, first_rightpan); if(weigh == 0){ cout &lt;&lt; "this program is working so far"; float second_leftpan = r5; //this brings up an error for some reason float second_rightpan = r6; weigh(second_leftpan, second_rightpan); //here's where I get the error, no conversion from 'int' to 'int (__cdecl *)(float,float)' if(weigh == 0){ //be careful here, changed from second_weigh to weigh float third_leftpan = r5; float third_rightpan = r7; weigh(third_leftpan, third_rightpan); } // int main() { //find the light rock findOddRock(2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 1.0); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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