Code Choser for ROBOTC

My student has used the sample program to help create a competition program, but he keeps getting this error message: “Error: Undefined variable ‘count’. ‘short’ assumed.” Any ideas on how to fix this?

I assume that you are using robotc from the error posted. The variable count has to first be declared before it can be used.

Example:
int count=0;//declares the variable count as an integer(what I believe is missing)

count=count+1;//operation on variable–this is where your error would be because the variable was not declared

This is correct. If you provide the code then we can be more specific about how to fix it.

Yes, we are using RobotC.
Here is the line that is gettin the error: “switch(count){”
The programmer has modified the “Code Choser” template to fit a competition program.

Please copy paste all of your code.

This is an excerpt from the sample code.

task main()
{
**        //Declare count variable to keep track of our choice
        int count = 0;
**
    //------------- Beginning of User Interface Code ---------------
    //Clear LCD
    clearLCDLine(0);
    clearLCDLine(1);
    //Loop while center button is not pressed
    while(nLCDButtons != centerButton)
    {
        //Switch case that allows the user to choose from 4 different options
        switch(count){
        case 0:
            //Display first choice
            displayLCDCenteredString(0, "Autonomous 1");

He has presumably excluded the code I highlighted.