The @ is not moving.
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;
}
|
Do you have a question?
The @ is not moving.
The question is why it's not moving?
Look very carefully at line 9.
line 9 you wrote i>41
, it should be i<41
Thanks :D.
Will the same program work in C++ console in windows applications..
It uses GetAsyncKeyState that's why I included windows.h
I've a question that is very curious for me...
that is how this "@" moves in console without flickering ???
how it is moving :P
nice program...
Topic archived. No new replies allowed.