Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C++ Project, need all the help i can get!
#28
So is does your assignment say to just work with the given input, or is that just example input and you need to have your code work for anything that follows that format? What you have right now will probably work for this specific input, but writing to an example is generally the wrong thing so I would expect you need to write this abstract enough to work with any correct input.

The best way to store the light's locations would be in their own array, size variable depending on the number of flood lights you're told exist. So you can make a 2d array by using

double** floodlights = new double*[num_floodlights];
for (int i = 0; i < num_floodlights; i++)
{
floodlights[i] = new double[2];
floodlights[i][0] = ~~measurementx~~
floodlights[i][1] = ~~measurementy~~
}

Where the stuff in tildes is data from the file. This lets someone build a system with two lights, five lights, or no lights, and it won't break.
Reply


Messages In This Thread
C++ Project, need all the help i can get! - by Kabanaw - 2014-05-02, 02:59 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)