Which header file I need to include to use gotoxy() function?

前端 未结 7 2190
夕颜
夕颜 2021-01-07 04:06

This is the student-report-card-project, I got some problems when I shifted this code to the dev C++ from borland C. Now when I try to complile the program in dev C++, it gi

7条回答
  •  猫巷女王i
    2021-01-07 04:10

    You'll need to create it yourself. Include , then:

    void gotoxy(int x, int y)
    {
      static HANDLE h = NULL;  
      if(!h)
        h = GetStdHandle(STD_OUTPUT_HANDLE);
      COORD c = { x, y };  
      SetConsoleCursorPosition(h,c);
    }
    

    I shouldn't have to say it, but obviously this is not portable outside Windows, if even that far.

提交回复
热议问题