#include<iostream>
#include<Windows.h>
#include<conio.h>
using namespace std;
void writestring(const char *, short, short, short = 7, short = 0);
void gotoxy(short, short);
int main()
{
writestring("My name is not khan", 20, 10, 4, 1);
_getch();
return 0;
}
void writestring(const char * str, short col, short row, short color, short pnumber)
{
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); //h is handle of current running program
SetConsoleTextAttribute(h, color); // Text of the screen now have color 4 (RED)
cout << "Page Number : " << pnumber << endl;
while (*str != '\0')
{
gotoxy(col, row);
putchar(*str);
col++;
str++;
}
}
void gotoxy(short col, short row)
{
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
COORD position = { col, row };
SetConsoleCursorPosition(h, position);
}