It looks fine. You don’t even need the switch to run user control. I would try some thing simple like motors on for user control to determine if the problem is with the controller connection. Maybe try no switch which I would be surprised if its broken.
I was just suggesting ways to figure out what the problem is. Just put with in the while loop one line of code which turns on a motor for user control. When you run user control and the motor turns on maybe its the controller input, if the motor doesn’t turn on its another problem.
Do you mean at the end of the program? If that’s the case, any code after a while(true) will never run.
Try to open one of the example programs, and run that. If the problem persists with that is is hardware issue, possibly the connection or field switch. Also, to run driver control, you never need a field switch. When there is no switch connected, the robot is automatically in driver control.
As has been pointed out, you are missing the pragma at the top. I had assumed that you already configured your motors and sensors (if applicable) and just didn’t copy paste it, but if you haven’t done that, that should fix it.