the else i have labeled has an error saying it is unnecessary. How can I get that else to line up with the first if?
if (heading < 270 && heading > 90)
directionToFace= 'S';
if (heading > 180)
{
degreeToWalk = (heading-180);
directionToWalk = 'W';
}
else
{
degreeToWalk = (180-heading);
directionToWalk = 'E';
}
else//this is where the error occurs
directionToFace='N';
{
if (heading > 270)
{
degreeToWalk =(heading-270);
directionToWalk='W';
}
else
{
degreeToWalk = (heading);
directionToWalk = 'E';
}
}
Aucun commentaire:
Enregistrer un commentaire