Академический Документы
Профессиональный Документы
Культура Документы
struct mesh
{
location lm;
mesh()
{
lm.x = (rand() % 5);
lm.y = (rand() % 5);
lm.z = (rand() % 5);
}
};
struct user
{
location lu;
user()
{
lu.x = (rand() % 5);
lu.y = (rand() % 5);
lu.z = (rand() % 5);
}
float distance(location lm)
{
return dis;
}
};
void main()
{ int u = rand() % 100;
int m = rand() % 100;
cout << "Total Number of Meshes is: " << m<<endl;
cout << "Total Number of Users is: " << u << endl;
while (c == 'e' )
{
user * USER = new user[u];
int Index = 0;
for (int j = 0; j < m; j++)
{
distance[j] = USER[i].distance(MESH[j].lm);
if (distance[j] < min)
{
min = distance[j];
Index = j ;
}
}
cout << "\nUser ( " << i + 1 << " ) is connected to Mesh ( " <<
Index + 1 << " )"<<endl;
}
cout << "Enter ( e ) to run again or any other key to exit "<<endl;
cout<<"Enter :";
cin >> c;
}
getch();