Results 1 to 5 of 5
  1. #1
    Lakshay's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    www.MPGH.net // General // Crossfire
    Posts
    4,545
    Reputation
    335
    Thanks
    1,102
    My Mood
    Angelic

    [Beginner's TuT] C++ - Area of Triangle

    This is my Tutorial for Beginners - Area of Triangle.

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
            //declare variables
            double lenght    = 0.0;
            double width     = 0.0;
            double area              = 0.0;
    
            //inpute items
            cout << "Enter lenght: ";
            cin >>    lenght;
            cout << "Enter width: ";
            cin >>  width;
    
            //Calculate Area
            area = width * lenght
    
            //Calculate
            cout << "Your area is: " << area << endl;
    
            return 0;
                    // end of main function
    Download Sample if you cant make it urself.
    Last edited by Lakshay; 06-07-2010 at 02:38 AM.

  2. #2
    lalakijilp's Avatar
    Join Date
    Jan 2008
    Gender
    male
    Posts
    310
    Reputation
    9
    Thanks
    53
    My Mood
    Blah
    THX!!!! I WIll use it when I find a triangle with 4 corners
    Last edited by lalakijilp; 06-07-2010 at 03:34 AM.

  3. #3
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    wait wait wait...

    triangle area is: x * y? LOL!

    what about (x*y)/2 ?

    and thats not a tutorial.. thats a piece of code that explains almost nothing..
    Last edited by 'Bruno; 06-07-2010 at 02:47 AM.
    Light travels faster than sound. That's why most people seem bright until you hear them speak.

  4. #4
    schim's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    My chair
    Posts
    367
    Reputation
    10
    Thanks
    114
    My Mood
    Twisted
    Quote Originally Posted by Brinuz View Post
    wait wait wait...

    triangle area is: x * y? LOL!

    what about (x*y)/2 ?

    and thats not a tutorial.. thats a piece of code that explains almost nothing..
    Yep, he's right x * y = area of a cube/rectangle/square
    Area of a triangle is: 0.5(x*y) or (x*y)/2
    You also forgot the closing bracket '}' at the end of your source

  5. #5
    mwb1234's Avatar
    Join Date
    May 2009
    Gender
    male
    Posts
    460
    Reputation
    7
    Thanks
    65
    Triangle area is not l * w. This is the area of a square. Other than that it is a good work, and you should make some more advanced tutorials. Try doing a tutorial that finds real roots of a quadratic equation... Good luck!

Similar Threads

  1. [Release] Part 1/13 Of Beginner C++ TuTs
    By Gοku in forum CrossFire Tutorials
    Replies: 10
    Last Post: 05-17-2011, 03:28 PM
  2. Maths - trigonometry AREA of triangle
    By Para DICE in forum Homework & Learning Section
    Replies: 7
    Last Post: 02-01-2011, 07:53 PM
  3. [TuT] C++ Beginners Tutorial
    By Invidus in forum C++/C Programming
    Replies: 1
    Last Post: 03-08-2010, 05:59 AM
  4. beginner intermediate tut based
    By moosicgawd in forum Showroom
    Replies: 2
    Last Post: 05-12-2009, 12:53 PM
  5. Replies: 3
    Last Post: 01-28-2009, 09:16 AM