The @ is not moving.
Jan 4, 2014 at 12:51am
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include<iostream>
#include "windows.h"
using namespace std;
bool loop = true;
void update(int px){
for(int i=1; i>41; i++){
if(px==i){
cout << "@";
}else{
cout << " ";
}
}
}
int x=1;
int main(){
while(loop==true){
system("pause>nul");
if(GetAsyncKeyState(VK_RIGHT)){
int fx = x+x;
if(fx>41){
return 0;
}else if(fx<0){
return 0;
}else{
system("cls");
x++;
update(x);
}
}
}
return 0;
}
|
Jan 4, 2014 at 12:59am
Do you have a question?
Jan 4, 2014 at 12:59am
The @ is not moving.
The question is why it's not moving?
Jan 4, 2014 at 1:01am
Look very carefully at line 9.
Jan 4, 2014 at 1:03am
line 9 you wrote i>41
, it should be i<41
Jan 4, 2014 at 1:04am
Thanks :D.
Jan 4, 2014 at 12:22pm
Will the same program work in C++ console in windows applications..
Jan 4, 2014 at 12:26pm
It uses GetAsyncKeyState that's why I included windows.h
Jan 4, 2014 at 12:42pm
I've a question that is very curious for me...
that is how this "@" moves in console without flickering ???
Jan 4, 2014 at 1:45pm
how it is moving :P
nice program...
Topic archived. No new replies allowed.