expression preceding parentheses of apparent call must have (pointer-to-) function type

Hello! I am getting the error message: expression preceding parentheses of apparent call must have (pointer-to-) function type. I have marked the line that is giving me problems.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 #include <iostream>
#include <cmath> 
#include <iomanip>
using namespace std;


int main()
{
	int population();
	{
		int LPopulation;
		int UPopulation;
		cout << "Enter the lower bound of a population in thousands. (1 = 1000, 10 = 10000, etc.)\n";
		cin >> LPopulation;
		cout << "Enter the upper bound of a population in thousands. (1 = 1000, 10 = 10000, etc.)\n";
		cin >> UPopulation;

		double sqrt;
		double Flowrate;
		int Population;
		while (LPopulation < UPopulation)
		{
			Population = LPopulation;
			Flowrate = 3.86 * sqrt(Population) * (1 - 0.01 * sqrt(Population)); // This one.
			++LPopulation;
			cout << setw(10) << left << "ten" << "four" << "four";
		}


	}
}
Line 18, what were you trying to do there? Get rid of it.

The output makes no sense.

Flowrate is unused.

Read the compiler output:

In function 'int main()':
18:10: warning: unused variable 'sqrt' [-Wunused-variable]
19:10: warning: variable 'Flowrate' set but not used [-Wunused-but-set-variable]

For the original question, see
https://www.chegg.com/homework-help/questions-and-answers/formula-calculates-estimated-flow-rate-water-fighting-fire-business-district-p-equals-popu-q35303881

Just use a for-loop to cover P values between lower and upper bounds and, for each pass of the loop, output P (population in thousands) and Q (volume flow rate of water required for fire fighting).

I'd love to know what the units of Q are, and also why, when the city gets to a population of 10 million, you don't bother fighting fires any more!
Last edited on
1
2
3
4
5
6
7
int main()
{
	int population();
	{
        // ...
	}
}


Please, tell me you aren’t trying to define a function inside main()…
Topic archived. No new replies allowed.