need with on homework.. noob here

This is a discussion on need with on homework.. noob here within the C Programming forums, part of the General Programming Boards category; Input : Maximum dimensions of an area (Xmax, Ymax), Number of nodes N, and distance D. Program function 1- Each ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    1

    need with on homework.. noob here

    Input : Maximum dimensions of an area (Xmax, Ymax), Number of nodes N, and distance D.

    Program function
    1- Each node has id.
    2 - Distribute the nodes in the area randomly, such as each node has a position (x , y)
    3 Each node is considered a neighbor to another node, if the distance between them is less than D.
    4 - A node degree is the number of its neighbor nodes. Average degree is the total number of neighbors divided by the nodes number N.

    Output
    1-The average node degree
    2-The degree of any node selected by the user.
    3-The minimum degree
    4-The maximum degree


    this is what i understand:
    1. use time to generate random point => coordinate = rand() % (x/y + 1)

    then i dunno how to start... pls help

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,854
    Well having assigned all the positions, the next step would seem to be to calculate all the 'D' values.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Homework
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 11-03-2001, 04:39 PM
  2. Homework
    By kermi3 in forum C Programming
    Replies: 10
    Last Post: 09-27-2001, 05:49 PM
  3. Homework
    By kermi3 in forum C++ Programming
    Replies: 15
    Last Post: 09-26-2001, 04:16 PM
  4. Homework
    By kermi3 in forum C Programming
    Replies: 0
    Last Post: 09-10-2001, 02:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21