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

Recommended Answers

All 3 Replies

It should be #include <cmath>

and remember to use CODE tags the next time.

Ok thanks a lot man.

Did you tryed #include <math.h>?

commented: The thread is solved and the suggestion is non-standard. -1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.