Code:
#include<stdio.h>
int main() {
int x=0;
int y=0;
char input;
printf( "Andrew Fowler, Assingment5 part2\n\n" );
printf( "Use G, J, Y, N, T, U, B, M as arrow inputs. Type q to quit\n");
while( input != 'q');
{
scanf(" %c", &input );
if (input = 'g'){ /*g = left move*/
x= x-1;
printf("Cordinates (X,Y) = (%d,%d)\n", x, y );}
if (input = 'j'){ /*j = right move*/
x= x+1;
printf("Cordinates (X,Y) = (%d,%d)\n", x, y );}
if (input = 'y'){ /*y = up*/
y= y+1;
printf("Cordinates (X,Y) = (%d,%d)\n", x, y );}
if (input = 'n'){ /*n = down*/
y= y-1;
printf("Cordinates (X,Y) = (%d,%d)\n", x, y );}
if (input = 't'){ /*t = up and left*/
x= x-1;
y= y+1;
printf("Cordinates (X,Y) = (%d,%d)\n", x, y );}
if (input = 'u'){ /*u = up and right*/
x= x+1;
y= y+1;
printf("Cordinates (X,Y) = (%d,%d)\n", x, y );}
if (input = 'b'){ /*b = down and left*/
x= x-1;
y= y-1;
printf("Cordinates (X,Y) = (%d,%d)\n", x, y );}
if (input = 'm'){ /*m = down and right*/
x= x+1;
y= y-1;
printf("Cordinates (X,Y) = (%d,%d)\n", x, y );}
}
scanf(" %c", &input ); /*Stops the Program from Ending Abruptly*/
return 0; /*Ends Programs*/
}