Split screen display with a win32 console app

I am writing a hangman game program for class which outputs to the windows command prompt. I would like to have the top half or third of the command prompt display the game information such as "# of guesses wrong", "letters guessed incorrectly", the disguised word itself and the person being hanged. If someone could point me in the right direction that would be appreciated.

Just a guess that this is what you need.
1
2
3
4
5
6
7
8
//gotoxy using windows.h
void gotoxy (int x, int y) {
    COORD coord; // coordinates
    coord.X = x; // X and Y coordinates
    coord.Y = y;
    // moves to the coordinates
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
gohome()
http://www.cplusplus.com/forum/beginner/22687/page2.html#msg121058

gotoxy()
Windows code above by blackcoder41.
POSIX code follows
1
2
#include <term.h>
#include <unistd.h> 
1
2
3
4
5
6
7
8
9
10
11
12
bool gotoxy( int x, int y )
  {
  if (!cur_term)
    {
    int result;
    setupterm( NULL, STDOUT_FILENO, &result );
    if (result <= 0)
      return false;
    }
  putp( tparm( tigetstr( "cup" ), y, x, 0, 0, 0, 0, 0, 0, 0 ) );
  return true;
  }

See the notes about the POSIX function in the other thread.

Hope this helps.
after some research it looks like vc++2005 express does not have windows.h, ty for the help
Hmm, that is messed up.

It looks like you have to either download and create the PlatformSDK directorys and integrate them into the IDE (info here)
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/2bfed529-fb6d-48a3-ad48-fc6301486646/

Or, what I would suggest, download a later version, like VS2008.

Alas.
You guys are great, ty

Before reading this i came up with a possible solution: could i use a clear screen command at the top of my while loop (before the initial output, after the resulting iteration and substitution of characters) to create the illusion of a static display?

It would blink each time you used it, and it is a security hole, but yes, that would work..
Topic archived. No new replies allowed.