|
-
Dec 17th, 2002, 08:06 AM
#1
Thread Starter
yay gay
#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);
}
\m/  \m/
-
Dec 17th, 2002, 08:18 AM
#2
transcendental analytic
maybe math.h?
squareroot is sqrt() not sqtr(), power is pow() although you can get away with cateto1*cateto1 resp..
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Dec 17th, 2002, 01:07 PM
#3
Monday Morning Lunatic
Re: #include "cmath.h"
Originally posted by PT Exorcist
it's givin error about cmath.h...but why?!?
Code:
#include <iostream>
#include <cmath>
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 17th, 2002, 07:34 PM
#4
Thread Starter
yay gay
no the problem is cmath...what should i do?
...
\m/  \m/
-
Dec 17th, 2002, 08:18 PM
#5
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.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 18th, 2002, 08:03 AM
#6
Thread Starter
yay gay
but my vc6++ compiler doesnt allow the include's without the extension!
\m/  \m/
-
Dec 18th, 2002, 08:05 AM
#7
Thread Starter
yay gay
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..
\m/  \m/
-
Dec 18th, 2002, 08:13 AM
#8
Monday Morning Lunatic
No. It's math.h and cmath. No extension.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 18th, 2002, 08:18 AM
#9
Thread Starter
yay gay
but if i put without extension i get error in the compiler!
\m/  \m/
-
Dec 18th, 2002, 08:19 AM
#10
Thread Starter
yay gay
damn im getting mad so many differences between what the book says and what i must do with vc6++...is borland's c++ best?
\m/  \m/
-
Dec 18th, 2002, 08:31 AM
#11
Monday Morning Lunatic
Visual C++ 6 supports cmath. At least it *should*, since v5 did. Personally, I think Microsoft's compiler absolutely trashes Borland's.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 18th, 2002, 08:33 AM
#12
Thread Starter
yay gay
but mine didnt...i think ill ask to some friend for his cd to see if theres any difference or somewhat :\
\m/  \m/
-
Dec 18th, 2002, 08:41 AM
#13
Even my introductory edition of VC++6 supported <cmath>. And that's the smallest edition you can get (it was free).
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 18th, 2002, 08:47 AM
#14
Addicted Member
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
-
Dec 18th, 2002, 10:19 AM
#15
Thread Starter
yay gay
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
\m/  \m/
-
Dec 18th, 2002, 12:00 PM
#16
Frenzied Member
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.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Dec 18th, 2002, 01:52 PM
#17
Thread Starter
yay gay
where should they point to?
\m/  \m/
-
Dec 18th, 2002, 05:04 PM
#18
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 18th, 2002, 08:57 PM
#19
Thread Starter
yay gay
yea it has math.h...but its confusing..because this should have cmath....bah
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|