Recurring problem with Code

All right will be updating if I get anything else that needs to fixed. thanks.
Last edited on
closed account (48T7M4Gy)
the bracket in line 5 is in the wrong place and the ; in line 2 shouldn't be there
I see multiple problems. Some of which may be settled with your #include file which I don't have access to... However, I find the following errors.

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
32
33
34
#include "../../std_lib_facilities.h"

double my_sqrt_1(double n);  // Is this a prototype? no n in parameter
                                             // Start of a function? use a { instead of ;
double upper_bound;
double lower_bound;
{                                              // No function name in front of bracket


	double x = 1;                                  // x is not used
	for (int i = 0; i < 10; ++i)
	{
		if (n < 1)
		{
			lower_bound = (n);
		}
		else if (n > 1)
		{
			lower_bound = (1 + (n - 1) / 2 - (n - 1)*pow(2) / 8);    // Is pow declared??
			upper_bound = ((n + 1) / 2);
		}
	}
}             // Are you returning a variable or should this function be a void ???


int main()
{
	double n;      
	for (auto k : { -100, -10, -1, 0, 1, 10, 100 })
	{
		n = M_PI*pow(10.0, k);                      // M_PI  not declared
		cout << n << " ," << sqrt(n) << " ," << my_sqrt_1(n) << '\n';  // sqrt not declared
	}
}
Last edited on
Topic archived. No new replies allowed.