Project question.

Posts 31–34 of 34 · Page 3 of 3
Quote Originally Posted by zeco View Post
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?
I showed you the wiki page, right? So basically, there's about 6 groups, each with one aspect of pre-calculus. Like trig, geometry(mine), algebra, logic, things like that. Kay? So we first have to explain what our project is about, give examples, show formulas used for that specific topic, and then make worksheets, and do a presentation. Now, the presentation, is something you could do however you like. Power point, movie, whatever. I'm doing mine based on programming, mk? Tty in a bit on MSN. :P
it is easier to make functions so you can add more calculations later on
Code:
#include <iostream>
#include <math.h>

#define pi 3.141592654

using namespace std;

void firstfunction ();

int main()
{
    char choice;
    do{
          
          cout << "which function do you like to use?!?" <<endl
           <<"1. firstfunction"<<endl
           << "q. to quit" <<endl << "enter your choice:";
           cin >> choice;
           cout << endl;
           switch(choice)
           {
                         case '1':
                              {
                                  firstfunction();
                              }
                         break;
           }
    }while (choice != 'q');

    cin.get();
    cin.get();
    return 0;
} 

void firstfunction ()
{
    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<<endl;
}
is this function used to calculate the surface of a triangle, square or 5-sided thing?
if it is it isnt working i think
Quote Originally Posted by lalakijilp View Post
it is easier to make functions so you can add more calculations later on
Code:
#include <iostream>
#include <math.h>

#define pi 3.141592654

using namespace std;

void firstfunction ();

int main()
{
    char choice;
    do{
          
          cout << "which function do you like to use?!?" <<endl
           <<"1. firstfunction"<<endl
           << "q. to quit" <<endl << "enter your choice:";
           cin >> choice;
           cout << endl;
           switch(choice)
           {
                         case '1':
                              {
                                  firstfunction();
                              }
                         break;
           }
    }while (choice != 'q');

    cin.get();
    cin.get();
    return 0;
} 

void firstfunction ()
{
    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<<endl;
}
is this function used to calculate the surface of a triangle, square or 5-sided thing?
if it is it isnt working i think
It's a formula to calculate the area of any polygon. From triangles, to anything. :P
Quote Originally Posted by t7ancients View Post
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!
Same here, 10th grade and in quadratic formulas/functions
Posts 31–34 of 34 · Page 3 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us