Activity Stream
48,167 MEMBERS
6835 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 4 of 4
  1.     
    #1
    Probation

    Default anyone can write this c++ code.

    Given set of points in the plane

    1. The minimum distance between two points.
    2. The maximum distance between two points.
    3. The largest area of a triangle which has vertices at given points.
    4. The area of a convex hull of the set of points.

    The values should be computed as a number with 5 digits after the decimal point.


    96 48
    91 94
    77 31
    3 2
    68 17
    33 9
    52 23
    99 78
    25 63
    18 89
    98 54
    82 64
    31 98
    99 71
    97 36
    32 49
    8 65
    63 61
    93 79
    48 93
    8 45
    59 54
    92 94
    47 0
    40 65
    25 16
    24 92
    79 35
    73 13
    41 89
    0 86
    21 14
    74 96
    82 15
    0 29
    20 76
    49 36
    66 24
    84 57
    4 38
    66 41
    53 47
    49 20
    92 91
    86 78
    63 64
    20 71
    24 81
    85 39
    63 48


    Thnx for help
    iamuser_2007 Reviewed by iamuser_2007 on . anyone can write this c++ code. Given set of points in the plane 1. The minimum distance between two points. 2. The maximum distance between two points. 3. The largest area of a triangle which has vertices at given points. 4. The area of a convex hull of the set of points. The values should be computed as a number with 5 digits after the decimal point. Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Banned
    is that your computer homework

  4.     
    #3
    Probation
    i have this code. i am learning cpp.
    i am beginner and trying to learn programming


    #include <iostream>
    #include <vector>
    #include <cmath>

    using namespace std;

    struct point
    {
    int x;int y;
    point () {}
    point (int a,int b) : x(a) , y(b) {}


    friend float dist (point a,point b)
    {
    int p1; int p2;

    (a.x>b.x) ? p1=a.x-b.x : p1=b.x-a.x;
    (a.y>b.y) ? p2=a.y-b.y : p2=b.y-a.y;

    return sqrt((p1*p1) + (p2*p2));
    }
    };

    struct triangle : public point
    {
    point a;point b;point c;
    triangle (point a1,point b1,point c1) : a(a1) , b(b1) , c(c1){}

    float area()
    {
    return (~( a.x*(b.y-c.y) + b.x*(c.y-a.y) + c.x*(a.y-b.y) ) /2) +1;
    }

    float perim() {return dist(a,b)+dist(b,c)+dist(a,c);}
    };


    int main()
    {
    point a(96,48);
    point b(91,94);
    point c(77,31);
    triangle d(a,b,c);
    cout << d.perim() << endl << d.area();
    system("pause");
    return 0;
    }


    how to modify this code and how to enter those above list numbers.

  5.     
    #4
    Member
    I think that's a difficult problem.

    With a "naive" algorithm you have:
    distances: if you have n points you have to check n? distances/pairs.
    area of triangles: if you have n points you have to check n? triangles.

    Is a naive algorithm ok? Because anything else:
    - beyond my capability
    - I don't have the time.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Write For Us
    By Kw3rLn in forum Webmaster Discussion
    Replies: 0
    Last Post: 12th May 2012, 04:55 PM
  2. New Place to write your Name
    By Pettrious in forum Useful Sites
    Replies: 1
    Last Post: 18th Aug 2011, 07:56 AM
  3. write your name with blood
    By leonight in forum Useful Sites
    Replies: 5
    Last Post: 3rd Dec 2010, 02:48 PM
  4. Write your first C# program!
    By iFlames in forum Web Development Area
    Replies: 10
    Last Post: 29th Jun 2010, 05:31 PM
  5. how do i write?
    By lig}{tning in forum vBulletin
    Replies: 10
    Last Post: 18th Aug 2009, 08:45 AM

Tags for this Thread

BE SOCIAL