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
conio.h but it isn't standard. You need to check if your OS (console) can handle it.
#include <conio.h>
You could write it on your own:
void gotoxy(int x, int y)
{
COORD c = { x, y };
SetConsoleCursorPosition( GetStdHandle(STD_OUTPUT_HANDLE) , c);
}
You'll need to create it yourself. Include <windows.h>
, 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.
<conio.h>
is part of DOS Based Turbo C++ Compiler. Remember the Blue Screen Compiler.
there is a small piece of code which works for me most of the time.....
#include<iostream>
#include<iomanip> //for setw();
using namespace std;
gotoxy(int x, int y)
{
cout<<setw(x); //horizontal
for(;y>0;y--) //vertical
cout<<endl;
}
int main()
{
gotoxy(10,20);
cout<<"ANYTHING";
return(0);
}
add this header and function in your code:
#include "windows.h"
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}