0

Could somebody help me please?!
I'm trying to include math.h in a simple program an it doesn't work.
I got following errormessage:"fatal error C1083: Cannot open include file: 'math': No such file or directory".
I've checked if math.h is in the include directorie of visualC++, and it is.
Here is an example of my source code:

#include <math>
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	cout << setw(5) << "x";
	cout << setw(15) << "sqrt(x)";
	cout << setw(10) << "sin(x)";
	cout << setw(15) << "sin(sqrt(x))" << endl << endl;

	cout << setprecision(2) << fixed << showpoint;
    double x = 0.0;
   
	while ( x < 3.3 )
	{
		cout << setw(5) << x;
		cout << setw(15) << sqrt(x);
		cout << setw(10) << sin(x);
		cout << setw(15) << sin(sqrt(x)) << endl;
		x += 0.2;
	}
	return 0;
}

So any idea?
Thanks

3
Contributors
3
Replies
5
Views
11 Years
Discussion Span
Last Post by bbman
0

It should be #include <cmath>

and remember to use CODE tags the next time.

Edited by Dani: Formatting fixed

-2

Did you tryed #include <math.h>?

Votes + Comments
The thread is solved and the suggestion is non-standard.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.