how do i use "gotoxy"??

why its not working??

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
38
39
#include<stdio.h>
#include<conio.h>
#include<dos.h>


void jump(){
     
     int x =  0, y = 0, xs = x + 1, ys =  y + 2;
     
     while (kbhit()){
           gotoxy(x,y);
           putchar('*');
           
           gotoxy(x,y);
           putchar (' ');
           
           x = xs;
           y = ys;
           
           if( x = 10)
           xs = x - 1;
           
           if (x = 0)
           xs = x + 1;
           
           if (y = 10)
           ys = y - 2;
           
           if (y = -10)
           ys = y + 2;
           
           } 
           }
           
           main(){
                  jump();
                  getch();
                  }
Lines 11-14: You write a '*' to the position (x,y) and then you write a space to the position (x,y). You will never see anything but spaces. (Because you are overwriting the stars with spaces.)

Lines 20, 23, 26, 29: Be careful -- you are using assignment statements here (=), not comparision (==).

You should set your compiler to complain about everything, and then write your code so that it produces as few complaints as possible.

Be careful with your indentation -- it can trip you up.
Line 32 should be outdented to match the while on line 10.
Line 33 should be outdented to match the void on line 6.
Line 35 should not be indented, and should start with int main().
Line 38 should be outdented to match the int on line 35.


I'm sorry you are stuck using an old Turbo C++ compiler. Outside of school, you should download a recent version of MinGW or Microsoft C++. They are all free and support modern C++.

MinGW-w64
http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download

TDM MinGW-w64
http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm64-gcc-4.9.2-3.exe/download

Microsoft Visual Studio Express
https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx

Hope this helps.
Thx.. but why dose it skeep my conio.h ???
Perhaps you meant to have

10
11
     while (!kbhit()){
           gotoxy(x,y);
Topic archived. No new replies allowed.