-
#include "cmath.h"
it's givin error about cmath.h...but why?!?
Code:
// troll1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream.h"
#include "cmath.h"
using namespace std;
void main()
{
int cateto1, cateto2;
cout << "Calcular a hipotenusa de um um triângulo sendo dados os seus catetos:\nCateto 1: ";
cin >> cateto1;
cout << "Cateto 2: ";
cin >> cateto2;
count << "A hipotenusa é" << hipotenusa(cateto1, cateto2);
}
int hipotenusa(int cateto1, int cateto2)
{
cateto1 = cateto1^2;
cateto2 = cateto2^2;
return sqtr(cateto1 + cateto2);
}
-
maybe math.h?
squareroot is sqrt() not sqtr(), power is pow() although you can get away with cateto1*cateto1 resp..
-
Re: #include "cmath.h"
Quote:
Originally posted by PT Exorcist
it's givin error about cmath.h...but why?!?
Code:
#include <iostream>
#include <cmath>
-
no the problem is cmath...what should i do?
...
-
cmath.h doesn't exist. math.h is the C-header, cmath is the C++ version. cmath.h is nothing.
As parksie wrote, and don't forget that everything is in the std namespace.
-
but my vc6++ compiler doesnt allow the include's without the extension!
-
omg tryed with math.h and worked...but shouldnt be this have a cmath.h? u said the C has math.h and c++ has cmath.h..
-
No. It's math.h and cmath. No extension.
-
but if i put without extension i get error in the compiler!
-
damn im getting mad so many differences between what the book says and what i must do with vc6++...is borland's c++ best?
-
Visual C++ 6 supports cmath. At least it *should*, since v5 did. Personally, I think Microsoft's compiler absolutely trashes Borland's.
-
but mine didnt...i think ill ask to some friend for his cd to see if theres any difference or somewhat :\
-
Even my introductory edition of VC++6 supported <cmath>. And that's the smallest edition you can get (it was free).
-
Are you using:
or...
It shouldn't matter - but it might...
I can't see why cmath wouldn't work - works fine for me on VC++ 6.
HD
-
tryed the two ways right now and none of the works..just works with " " s and extension..maybe that's happening beacuse this is a riped version or something like that :confused:
-
What error do you get than? And you're sure your including
using namespace std also? Also make sure the include paths of your compiler are right.
-
where should they point to?
-
-
yea it has math.h...but its confusing..because this should have cmath....bah