The purpose of the following code is to get a random number of 100 nodes and to distribute these nodes randomly in range 500*500 …(X,Y).. this was the first step

#include<iostream>  
#include <fstream>  
#include<cmath>  

using namespace std;  

int  main()   
{  
 const int x = 0, y = 1;   
 int nodes[100][2];    
 ofstream myfile;  
 myfile.open ("example.txt");     
 myfile << "Writing this to a file.\n";  

 for (int i=0; i<100 ;i++)  
 {     
      nodes[i][x] = rand() % 501;    
      nodes[i][y] = rand() % 501;  
      myfile <<nodes[i][x]<<" "<<nodes[i][y];  
 }

 myfile.close();
}

the next step is to divide the the x and y axis will be divided in to 55 , so I will have 25 grids
Starting the axis from 0-99-199-299 until 499 ,what I’m trying to do is to distribute 4 nodes in each “100
100” grid
I try to do it by rewrite the code, but I get an error and I could not understand it

"IntelliSense: expression preceding parentheses of apparent call must have (pointer-to-) function type"
how can i fix it

#include <iostream>  
#include <fstream>  
#include <cmath>  

 using namespace std;  



 int  main()   

 {  
     ofstream myfile;  
    myfile.open ("example.txt");  
    myfile << "Writing this to a file.\n"; 


 int miny=0,max_y=99;
for(int i=0;i<5;i++)
{
    int minx=0,max_x=99;
for(int j=0;j<5;j++)
{
    for(int k=0;k<=4;k++)
    {
    int     x=(minx+rand()*10(max_x +1)%(max_x - minx+1));
    int     y=(miny+rand()*10(max_y +1)%(max_y - miny+1));
    }
    minx=max_x+1;
    max_x=max_x+100;
}
miny=max_y+1;
max_y=max_y+100;
}


 }

i want to fill 5x5 contiguous 2D cells of size 100x100 each with 4 random points.

T

Every cell will be processed independently, using a double loop on X and Y (from 0 to 500 excluded, step 100).

For each cell, generate 4 random points with coordinates in the range 100x100 (i.e. the cell size).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.