well, it makes it pretty clear you need to use quaternions. Have you coded up a class to do those yet? If not, sounds like a place to start.
-- I honestly think they are over-used. If you are not going very long distances in the anomaly direction, you can just add like .0001 radians the get away from the problem and use normal math which is faster (q's take a lot of extra trig calls). Someone in a game can't tell the difference until you get very, very far along the same line, and who goes in a straight line for very long in any game?
Enter sphere centre (vector): 0 0 0
Enter sphere radius: 5
Enter ray origin (vector): 2 -1 -1
Enter ray direction (vector): 0 2 3
Closest intersection at 2 -2.76807 -3.6521
thank goodness for google! However, I am feeling merciful and the sites are often written in phd level mathspeak, so I will give you the overview. You WILL need the web to get the equations, though.
ok so the idea is, from a rocket ship perspective: if, in 3-d, you go 'straight up' rotating about the same axis (so if up is y axis, your vehicle rotates about y) and then come back down to fly level (x and z plane), you cannot tell your correct orientation because it was LOST in the zeros from the sins/cosines during the event. Every 3-d axis can do this (meaning any 3-d coordinate system/space has this problem, but not every problem in 3-d space does the moves that lose info); the trig functions are not sufficient to track the angles through. To fix that, the 3-d information is remapped to a special 4 dimensional space (quad / quat being 4 from latin roots) that has redundant information in the terms. The extra terms keep the lost information so you can restore it and know your orientation. The idea is that simple. The math under isnt bad either, but its confusing the first time you see it esp if you are not a strong math student. Thankfully the math has been done for you, and all you need to do is look it up and implement a little class with some operator overloads and maybe a conversion back to a 3-d orientation (xyzhpr all 6 dof) object (vector or array is all you need for this, not another class).
Again, I think gamers spend too much time on this. You can fudge it away, rather than deal with quaternions, for most games. Real physics models need to do it right, though. Its still something you should at least be aware of. Ever played a game where once in a rare while an object freaks out, spinning and jerking all over? This is one cause of that kind of bug.
I haven't been in class for a while, so I have no clue where to start
... well, there comes a time to drop the class or take the F. I don't know if you can recover or not, depends on how good you are and how much you want to pass or how good you are at cheating. May as well get that over with too: this isnt a place to get it done FOR you. This is where you get HELP after TRYING.
you don't need them here. I can't even see where you would need one, maybe this isn't the whole thing?
I will change my answer then: fill in the provided classes first, and worry about the quaternions later if you need them. C++ has a dot product, if you decide you need that... https://en.cppreference.com/w/cpp/algorithm/inner_product