loops problem

having difficulty with my code , the user is suppose to input a character and then move it , up , down , ;left and right using the keys : i,j,k,l on the keyboard. however so far with my code it just moves to left no matter what key i press.

here is my code so far :

#include<iostream>
#include"110ct.h"
#include<string>

using namespace std;

int main()
{
CursorController crs;
ColourController cl;


int Number;// the number of stairs
int Amount = 1; // this is the amount of x it will add to the line

string A;// this is the variable for the character
char movementi = 'i' ;// this is the variable to move the character
char movementk = 'k';
char movementj = 'j';
char movementl = 'l';

double xval ,yval;
xval= 2;// the set x postion coordinates
yval= 3;//the set x postion coordinates


cout << "Enter in how many 'stairs' you want" << endl;
cin >> Number;
cout << " now enter a special character to move up and down the starirs \n";
cin >> A;

for(int c = 0; c < Number; c++)
{
for(int d = 0; d < Amount; d++)
{
cout << "*";//the charater for the stair
}

cout << endl;
Amount +=1; //Adds 1 'X' after every new line

}
while( movementi =='i')
{
yval=yval-0.5;
crs.setPosition(xval,yval);
cout << A <<"\n";
qin>>movementi;
crs.clearAll();
cout<< " to move the special character press the following keys \n";
cout<< " press i for up \n k for down \n j for left and l for right \n";// intructions for the keys

}
while( movementk == 'k')
{
yval=yval+0.5;
crs.setPosition(xval,yval);
cout << A <<"\n";
qin>>movementk;
crs.clearAll();
cout<< " to move the special character press the following keys \n";
cout<< " press i for up \n k for down \n j for left and l for right \n";// intructions for the keys

}
while( movementj == 'j')
{
xval=xval-0.5;
crs.setPosition(xval,yval);
cout << A <<"\n";
qin>>movementj;
crs.clearAll();
cout<< " to move the special character press the following keys \n";
cout<< " press i for up \n k for down \n j for left and l for right \n";// intructions for the keys

}
while( movementl != 'l')
{
xval=xval+0.5;
crs.setPosition(xval,yval);
cout << A <<"\n";
qin>>movementl;
crs.clearAll();
cout<< " to move the special character press the following keys \n";
cout<< " press i for up \n k for down \n j for left and l for right \n";// intructions for the keys
}


qin.get();

return 0;
}
loo
Topic archived. No new replies allowed.