lundi 1 octobre 2018

How can I switch what points on an array equal in c++?

These change the array that I print to the screen. direc is an input before this. However, when array[1][2] == '#', it still moves '#' to array[1][0].

if (array[1][1] == '#' && direc == 'A' || direc == 'a' ){


            array[1][1] = '_';
            array[1][0] = '#';
    }

        else{
            if (array[1][1] == '#' && direc == 'D' || direc == 'd' ){

            array[1][1] = '_';
            array[1][2] = '#';


    }
        else{
            if (array[1][2] == '#' && direc == 'A' || direc == 'a'  ){

            array[1][1] = '#';
            array[1][2] = '_';
        }
    }
        }

Aucun commentaire:

Enregistrer un commentaire