1 Replies - 17824 Views - Last Post: 15 February 2011 - 10:16 AM Rate Topic: ***** 1 Votes

#1 rgettens  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 13-November 08

gotoxy(x,y) in visual Studio 2010

Posted 15 February 2011 - 10:06 AM

Good afternoon,

I just upgraded my disosaur Visual Studio 6 to 2010 and am having problems with

[ gotoxy(x,y) ]

Did Microsoft take out the bool library and for that matter, the conio library? This simple "doodle Program" that worked perfectly in VS 6 does not work at all in VS 2010:


    /*Doodle program */
    #include <iostream.h>
    #include <conio.h>
    #include <random.h>

    int main()
    {
    randomize();
      cout << "Doodler! Press I/J/K/M to move, Q to quit" << endl;
    char KeyPressed; // Key pressed by user
    int x=40; int y=10; // Establish initial position of cursor
 
    do {
     // Plot a "point"
     gotoxy(x, y);
     cout << '*';
     gotoxy(x, y); // Move blinking cursor under current spot
     KeyPressed = getch(); // Get a key, not echoing to the screen
      if (KeyPressed == 'I' || KeyPressed == 'i')
     y--;
     else if (KeyPressed == 'M' || KeyPressed == 'm')
     y++;
      else if (KeyPressed == 'J' || KeyPressed == 'j')
       x--;
      else if (KeyPressed == 'K' || KeyPressed == 'k')
       x++;
      else if (KeyPressed == 'Q' || KeyPressed == 'q')
      ; // Do nothing
      else
       cout << "\a"; // Beep for bad keystroke
     } while ((KeyPressed != 'Q') && (KeyPressed != 'q'));
       gotoxy(1, 1); // Clear and display new title
       clreol();
       cout << "Random stars! Press any key to stop." << endl;
       while (!kbhit()) {
       gotoxy(1+random(60), 2+random(20));
         cout << "* "; // A star and a blank to draw AND erase
    }
      return (0);
   }


Any help would be greatly appreciated!
Thanks,
RG

This post has been edited by macosxnerd101: 15 February 2011 - 10:08 AM
Reason for edit:: Please use code tags


Is This A Good Question/Topic? 0
  • +

Replies To: gotoxy(x,y) in visual Studio 2010

#2 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: gotoxy(x,y) in visual Studio 2010

Posted 15 February 2011 - 10:16 AM

Welcome to the modern era. :)

See the Console class: Console.SetCursorPosition Method
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1