C++ Expression preceding parentheses
<p>I'm currently working on a set of code where we had to rework the code from all being written in the main and breaking it up into two subfunctions and the main. I've broken it up, but I am having trouble reading in one of my subfunctions. I never learned parameter passing in depth because my professor only briefly touched on it. </p>

<p>The error I'm getting is "Expression preceding parentheses of apparent call must have (pointer-to-) function type."</p>

<p>This is the line of code I'm having an issue with:....</p>

<pre><code>type = selectCarpet(type, unitPrice);
unitPrice = oneRoom(pricePerSqYd, count, ftLength, ftWidth, ftSq, ydSq, squareYd, materialCost, totalCost, unitPrice);
</code></pre>

<p>and this is the function:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;conio.h&gt;
#include &lt;string&gt;
using namespace std;

const double BEST = 6.99,
MEDIUM = 4.59,
BASIC = 3.50,
INSTALL = 129.99;
const int NINE = 9;


int selectCarpet(int type, int unitPrice);

double oneRoom(double pricePerSqYd, int count, double ftLength, double    ftWidth, int numRooms, double ftSq, double ydSq, int squareYd, double materialCost, double unitPrice, double totalCost);

int main()
{
    double ftLength,        // room length in feet
    ftWidth,            // room width in feet
    ftSq,           // square footage
    ydSq,           // square yard
    materialCost,   // carpet material cost
    totalCost,      // material cost plus install
    grandTotal,
    unitPrice;
int squareYd,       // square yards, round off
    type,           // carpet type
    count,
    numRooms;
type = 0;
unitPrice = 0;
double pricePerSqYd,
    oneRoom;

type = selectCarpet(type, unitPrice);

totalCost = 0;
cout &lt;&lt; "\nEnter number of rooms: ";
cin &gt;&gt; numRooms;

unitPrice = oneRoom(pricePerSqYd, count, ftLength, ftWidth, ftSq, ydSq, squareYd, materialCost, totalCost, unitPrice);

// step 11
grandTotal = 0;
grandTotal += totalCost;

cout &lt;&lt; "\n\nThe grand total price is "
    &lt;&lt; grandTotal &lt;&lt; endl;

// step 13
do
{
    cout &lt;&lt; "\n\t\t*** CARPET INSTALLATION ***\n\n";
    cout &lt;&lt; "Select carpet type:\n"
        &lt;&lt; "1 - Best Quality, Unit Price $6.99\n"
        &lt;&lt; "2 - Medium Quality, unit price $4.59\n"
        &lt;&lt; "3 - Basic Quality, Unit price $3.50\n"
        &lt;&lt; "4 - exit\n"
        &lt;&lt; "Enter your choice --&gt; ";
    cin &gt;&gt; type;
} while (type != 1 &amp;&amp; type != 2 &amp;&amp; type != 3 &amp;&amp; type != 4);

return 0;
}


int selectCarpet(int type, int unitPrice)
{
do
{
    cout &lt;&lt; "\n\t\t*** CARPET INSTALLATION ***\n\n";
    cout &lt;&lt; "Select carpet type:\n"
        &lt;&lt; "1 - Best Quality, Unit Price $6.99\n"
        &lt;&lt; "2 - Medium Quality, unit price $4.59\n"
        &lt;&lt; "3 - Basic Quality, Unit price $3.50\n"
        &lt;&lt; "4 - exit\n"
        &lt;&lt; "Enter your choice --&gt; ";
    cin &gt;&gt; type;
} while (type != 1 &amp;&amp; type != 2 &amp;&amp; type != 3 &amp;&amp; type != 4);

while (type != 4)
{
    // step 2
    if (type == 1)  unitPrice = BEST;
    else if (type == 2) unitPrice = MEDIUM;
    else if (type == 3) unitPrice = BASIC;
}

return unitPrice;
}

double oneRoom(double pricePerSqYd, int count, double ftLength, double ftWidth, int numRooms, double ftSq, double ydSq, int squareYd, double materialCost, double unitPrice, double totalCost)
{
    for (count = 0; count &lt; numRooms; count++)
    {
    cout &lt;&lt; "Enter room length in feet: ";
    cin &gt;&gt; ftLength;
    cout &lt;&lt; "Enter room diwth in feet: ";
    cin &gt;&gt; ftWidth;

    // step 5
    ftSq = ftLength * ftWidth;

    // step 6
    ydSq = ftSq / NINE;

    // step 7
    squareYd = int(ydSq + .5);

    // step 8
    materialCost = squareYd * unitPrice;

    // step 9
    totalCost = materialCost + INSTALL;

    // step 10
    cout &lt;&lt; setiosflags(ios::fixed | ios::showpoint)
        &lt;&lt; setprecision(2);
    cout &lt;&lt; "\n\nSquare footage of the room is: " &lt;&lt; ftSq
        &lt;&lt; "\nSquare yard of the room is:\t" &lt;&lt; ydSq
        &lt;&lt; "\nSquare yards priced for: " &lt;&lt; squareYd
        &lt;&lt; "\nMaterial Cost:\t$" &lt;&lt; materialCost
        &lt;&lt; "\nInstallation\t$" &lt;&lt; INSTALL
        &lt;&lt; "\nTotal Cost\t$" &lt;&lt; totalCost
        &lt;&lt; endl &lt;&lt; endl;
}
return pricePerSqYd;
}
</code></pre>

<p>any help is appreciated as I have almost no idea what I am doing here. Thank you.</p>