I wrote this code last week and it is not entirely correct. I have to add Create functions based on your existing source code (ex. GetCar, CreateCar, CalculateLapTime) which take in the appropriate parameters and give the correct output. Use pointers where applicable.
Move validation code into functions where appropriate, and throw an exception if the input does not match your validation rules. Handle the exceptions accordingly in your main function, and output the error message to the console.
To it for this week. I need help badly. I am lost. Code below from last week......
/** \brief A function that creates a new Car object with random values for the minutes and seconds
*/
Car CreateCar(int number)
{
// last weeks magic code goes here
}
...
int main()
{
...
// fill up the array with Cars
for (int i = 0; i < SIZE; i++)
{
cars[i] = Create(i);
}
...
}
I don't understand. Did I say Radboud? lol I have no idea what that is. Would that be how I fix the array currently there or is that part of the new stuff I need to incorporate? Can you break it down for me please...
Would I keep all of last weeks code then? And start this weeks with the example? Would that be the whole thing? I really appreciate you taking the time out to help me, I am in over my head.
ok I think that is a function, now will I need multiple functions to make it run properly? I do not believe my error message was put in properly, any ideas how to fix?
I think they want you to look at the code you created last week and find that it consists of different sections. One of those sections is a loop where you create the Car objects, another is where you calculate lap times and so on.
If I were you I would create a new file, with a main function and the prescribed functions and subsequently try to find the corresponding section in last weeks code. One you found it, you copy it into the new function.
Finally, you update your main function to use the functions.
For example
1 2 3 4 5 6 7 8 9 10
int main()
{
for (int i=0; i<10; i++)
{
std::string name;
std::cout << "what is your name?\n";
std::cin >> name;
std::cout << "hello, " << name << "\n";
}
}
I see and yes when I deleted the last paragraph it compiled with no errors from last week. My whole visual studio was down so I could not test before I submitted which was a complete disaster. Thank you for your help.