How would I go about putting my code in the competition template?

I know there are instructions in the template itself, but I think I am interpreting them in a different fashion. Could anyone instruct me on how to input my user control code into the competition template? Both my code and competition template are attached below.


#include "robot-config.h"


int Catapult = 0;
bool Intake = 0;
int Lift = 0;
bool StoppingType = 0;
bool DriveSpd = 0;



        ////////////////
        //   Switch   //
        ////////////////

void ChangeIntake()
{   
    if(Catapult == 1)
    {
       ::Intake = !Intake; 
    } 
}
void SwitchFunction()
{   
    while(true)
    {
        Brain.Screen.clearScreen();
        Brain.Screen.setCursor(1,1);
        Brain.Screen.print(Intake);
         
        if(Catapult == 0)
        {        
            Intake = 0;
            LSwitch.stop();
            RSwitch.stop();
        }
        else if(Catapult == 1)
        {
            if(Lever.pressing())
            {
                Controller1.ButtonL1.pressed(ChangeIntake);
                if(Intake == 0)
                {
                    LSwitch.stop();
                    RSwitch.stop();
                }
                else if(Intake == 1)
                {
                    LSwitch.spin(vex::directionType::fwd,100,vex::velocityUnits::pct);
                    RSwitch.spin(vex::directionType::fwd,100,vex::velocityUnits::pct);                    
                }
            } 
            else
            {
                Intake = 0;
                LSwitch.spin(vex::directionType::rev,100,vex::velocityUnits::pct);
                RSwitch.spin(vex::directionType::rev,100,vex::velocityUnits::pct);                
            }
        }
        else if(Catapult == 2)
        {
            LSwitch.spin(vex::directionType::rev,100,vex::velocityUnits::pct);
            RSwitch.spin(vex::directionType::rev,100,vex::velocityUnits::pct);
            vex::task::sleep(300);
            Catapult = 0;
        }
    }
} 


void ChangeCatapult()
{   
    if(Catapult == 2)
    {
        Catapult = 1;
    }
    else
    {
        Catapult++;
    }
}




        ///////////////////
        //     DRIVE     //
        ///////////////////

void SwitchDrive()
{
    ::DriveSpd = !DriveSpd;
}

void SwitchStopping()
{
    ::StoppingType = !StoppingType;
}

void BrakeFunction()
{
    while(true)  
    {
        if(StoppingType == 0)
        {
            Controller1.Screen.clearLine();
            Controller1.Screen.print("Unlocked");
            LMotor1.setStopping(vex::brakeType::brake);
            LMotor2.setStopping(vex::brakeType::brake);
            RMotor1.setStopping(vex::brakeType::brake);
            RMotor2.setStopping(vex::brakeType::brake);
        }
        else if(StoppingType == 1)
        {
            Controller1.Screen.clearLine();
            Controller1.Screen.print("Locked");
            LMotor1.setStopping(vex::brakeType::hold);
            LMotor2.setStopping(vex::brakeType::hold);
            RMotor1.setStopping(vex::brakeType::hold);
            RMotor2.setStopping(vex::brakeType::hold);                
        }       
    }    
}
void DriveFunction() 
{             
    while(true)
    {
        if(DriveSpd == 0)
        {
            LMotor1.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
            LMotor2.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
            RMotor1.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
            RMotor2.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
        }
        else if(DriveSpd == 1)
        {
            LMotor1.spin(vex::directionType::fwd, Controller1.Axis3.value()/3, vex::velocityUnits::pct);
            LMotor2.spin(vex::directionType::fwd, Controller1.Axis3.value()/3, vex::velocityUnits::pct);
            RMotor1.spin(vex::directionType::fwd, Controller1.Axis2.value()/3, vex::velocityUnits::pct);
            RMotor2.spin(vex::directionType::fwd, Controller1.Axis2.value()/3, vex::velocityUnits::pct);            
        }
    }
}
    



        /////////////////////
        //    Lift / Cap   //
        /////////////////////

void LiftFunction() 
{
    while(true)
    {
        LiftMotor.spin(vex::directionType::fwd,Controller2.Axis2.value(),vex::velocityUnits::pct);
    }
}
void CapFunction()    
{
    while(true)
    {
        CapMotor.spin(vex::directionType::fwd,Controller2.Axis4.value()/2,vex::velocityUnits::pct);
    }
}



    ///////////////////
    //   Main Task   //
    ///////////////////


int main() 
{   
    CapMotor.resetRotation();
    LiftMotor.resetRotation();
    
    RMotor1.setReversed(true);          
    RMotor2.setReversed(true);   
    LiftMotor.setReversed(true);
    LSwitch.setReversed(true);
    
    LSwitch.setStopping(vex::brakeType::coast);
    RSwitch.setStopping(vex::brakeType::coast);
    
    LiftMotor.setStopping(vex::brakeType::hold);
    CapMotor.setStopping(vex::brakeType::hold);
    
    Controller1.ButtonY.pressed(SwitchStopping);
    Controller1.ButtonB.pressed(SwitchDrive);
    
    Controller2.ButtonR1.pressed(ChangeCatapult);
    
    vex::thread drivethread (DriveFunction);
    drivethread.detach();    
    vex::thread brakethread (BrakeFunction);
    drivethread.detach();
    vex::thread liftthread (LiftFunction);
    liftthread.detach();
    vex::thread capthread (CapFunction);
    capthread.detach(); 
    vex::thread switchthread (SwitchFunction);
    switchthread.detach();   
}


#include "robot-config.h"
/*---------------------------------------------------------------------------*/
/*                                                                           */
/*        Description: Competition template for VCS VEX V5                    */
/*                                                                           */
/*---------------------------------------------------------------------------*/

//Creates a competition object that allows access to Competition methods.
vex::competition    Competition;

/*---------------------------------------------------------------------------*/
/*                          Pre-Autonomous Functions                         */
/*                                                                           */
/*  You may want to perform some actions before the competition starts.      */
/*  Do them in the following function.  You must return from this function   */
/*  or the autonomous and usercontrol tasks will not be started.  This       */
/*  function is only called once after the cortex has been powered on and    */ 
/*  not every time that the robot is disabled.                               */
/*---------------------------------------------------------------------------*/

void pre_auton( void ) {
  // All activities that occur before the competition starts
  // Example: clearing encoders, setting servo positions, ...
  
}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              Autonomous Task                              */
/*                                                                           */
/*  This task is used to control your robot during the autonomous phase of   */
/*  a VEX Competition.                                                       */
/*                                                                           */
/*  You must modify the code to add your own robot specific commands here.   */
/*---------------------------------------------------------------------------*/

void autonomous( void ) {
  // ..........................................................................
  // Insert autonomous user code here.
  // ..........................................................................

}

/*---------------------------------------------------------------------------*/
/*                                                                           */
/*                              User Control Task                            */
/*                                                                           */
/*  This task is used to control your robot during the user control phase of */
/*  a VEX Competition.                                                       */
/*                                                                           */
/*  You must modify the code to add your own robot specific commands here.   */
/*---------------------------------------------------------------------------*/

void usercontrol( void ) {
  // User control code here, inside the loop
  while (1) {
    // This is the main execution loop for the user control program.
    // Each time through the loop your program should update motor + servo 
    // values based on feedback from the joysticks.

    // ........................................................................
    // Insert user code here. This is where you use the joystick values to 
    // update your motors, etc.
    // ........................................................................
 
    vex::task::sleep(20); //Sleep the task for a short amount of time to prevent wasted resources. 
  }
}

//
// Main will set up the competition functions and callbacks.
//
int main() {
    
    //Run the pre-autonomous function. 
    pre_auton();
    
    //Set up callbacks for autonomous and driver control periods.
    Competition.autonomous( autonomous );
    Competition.drivercontrol( usercontrol );

    //Prevent main from exiting with an infinite loop.                        
    while(1) {
      vex::task::sleep(100);//Sleep the task for a short amount of time to prevent wasted resources.
    }    
       
}

see this post in this thread https://vexforum.com/t/how-to-test-the-competition-switch-with-v5-competition-iscompetitionswitch/49423/1