Project question.
Sometimes if you include other headers that already #include math.h in them it could cause problems...
I don't know... I think d3d9.h includes windows.h
You could implement any math equation you wanted to, provided you know your math very well. I'm only in 10th grade so the most I've done is quadratic functions, but the concepts are similar. use the basic operators to write your own functions to solve a problem. or like why06 said, math.h has some useful functions in there. You'll probably have better luck just writing your own though, because you'll understand how it works better and if you get an error you'd be less confused. Whenever we learn something new in math class I bring my notes home and write a program to solve the type of problem we just learned. This helps me with my math and my programming at the same time!
Dude, that's awesome. Thanks for the tip! I'll try doing that with my math hw. xD I'm in grade 11, and atm I'm doing Solving Radical Equations, and Rationals as well. Mostly review, but geometry is something I haven't covered in class, but my group has a project on it so we have to learn it beforehand.
No problem. This is my favorite way to learn my math because I love to practice programming and trying to make a problem solving program with what you learned really helps it stick. plus after a while you have a wealth of source code to refer to. what I did is I made a folder with some windows command scripts (.cmd, or .bat) that copy my .cpp, .h, .exe, .obj, .dll, .asm, .vbs, .js, .vb, .cs, .java, .htm, and .class files into folders in that folder for organization and then deletes the ones in the main folder. Also I made scripts to compile my java and c++ source. I use borland 5.5 for c++ because of the command line usage. it's nice. sort of like a primitive IDE made with batch files and a bunch of folders.
I pretty much just know the basics too, I guess I learned c++ without once using classes or structs. so no OOP for me. I'm going to start using c# tomorrow to grasp OOP better. using basic functions and stuff like that I can throw together some useful things. time for me to get some sleep, it's late here. good luck with it all and see you around 

Oh right, well I guess i should post my theoretical program...... It didnt work though.... I tested it on a square and got a strange answer v_v
Then again, just using the equation and a calculator i get an even stranger answer.
[php]
#include <iostream>
#include <math.h>
#define pi 3.141592654
using namespace std;
int main()
{
double area;
double S;
double N;
cout << "What is the number of sides?";
cin >> S;
cout << "What is the length of sides?";
cin >> N;
area = ( (S*S) * N )/( 4 * tan(pi/N) ) ;
cout << "Area = " << area << " ~!" << endl;
cin.get();
cin.get();
return 0;
}
[/php]
Then again, just using the equation and a calculator i get an even stranger answer.
[php]
#include <iostream>
#include <math.h>
#define pi 3.141592654
using namespace std;
int main()
{
double area;
double S;
double N;
cout << "What is the number of sides?";
cin >> S;
cout << "What is the length of sides?";
cin >> N;
area = ( (S*S) * N )/( 4 * tan(pi/N) ) ;
cout << "Area = " << area << " ~!" << endl;
cin.get();
cin.get();
return 0;
}
[/php]
In calculus if you get an even stranger answer, it's probably right. xD But yeah. I've experienced some problems using the math.h, I made the program right, I tried multiple headers for the varibles and it still gives s weird answer. One sec. Also this program isn't any use to the thread creator, just shows how to use the pow() function in math.h.
[php]#include <iostream>
#include <math.h>
using namespace std;
int main()
{
cout <<"Please input a number: " << endl;
float x;
cin >> x;
float y = pow(x, 2);
cout << x << "To the second power is " << y << ".";
system("pause");
return 0;
}
[/php]
Actually, the program zeco created was use to me after all. I asked my teacher, and he said that I can use it to demonstrate for my presentation in December. Now, I just needa make 4 more programs later on.
J(zeco), I'm gonna ask my teacher if the answer I get with the program is correct, or I'll ask him how to do it on a calculator in real life, because I think the part we did wrong had something to do with tangent having no value.
J(zeco), I'm gonna ask my teacher if the answer I get with the program is correct, or I'll ask him how to do it on a calculator in real life, because I think the part we did wrong had something to do with tangent having no value.
D'accord, mais tu ne m'a pas demandé si tu pouviez utiliser mon program.
Jking xD
But yeah, i got some damn funky answers for the area of a square with side lengths of 10 (something like 7000?) The answers i get with this are much closer.
And what the hell kind of open ended assignment are you doing if you can make computer programs and that be considered ok?
Jking xD
But yeah, i got some damn funky answers for the area of a square with side lengths of 10 (something like 7000?) The answers i get with this are much closer.
And what the hell kind of open ended assignment are you doing if you can make computer programs and that be considered ok?
This thread is closed for replies.




