PLZ Help me .. in Arrays .

In network simulation, node placement is one way to create and describe a simulated network. Write a C++ program to create a node placement file named “Nodes_Loc.txt” for 50 nodes in a network of size = W x L where W, L >= 100. The user should enter the dimensions W and L of the network. The node placement file must include the node Id (which is an integer number between 1 and 50) and its location (x,y) which is generated randomly. Also, the location of any node must be within network area and no two nodes should have the same location. The distance between two nodes must be at least 2 to avoid interference between them. For a sample input of W = 100 and L = 100, the node placement file should look like:

0 (86.645, 4.559)
1 (21.641, 72.716)
2 (18.149, 19.028)
3 (55.382, 27.754)

50 (21.174, 94.797)
Your program must implement and use the following:
1. Two arrays for x coordinate and y coordinate of node locations.
2. The function: void rand_location(float& , float&) to generate a random location for a node. There should be a uniqe seed for each run.
3. The function: bool exist_val(float axis[], float a) to check if the coordination is already exist or not.
4. The function: bool interferance(float a, float b, float axis_1[],float axis_2[]) to check if the current node location is interfering with other nodes or not.
5. The function: void insert(float axis[], float a, int index) to insert the value a into the array at offset index.
6. The function: int write_loc(float axis_1[],float axis_2[]) to write out the node placement file.



I am waiting your help as soon as possible .


Regards ,
Topic archived. No new replies allowed.