In this post, we will write a C++ program to display a word in the middle of the screen.
C++ program to display words in the middle of the screen.
#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<windows.h>
BOOL gotoxy(const WORD x, const WORD y) {
COORD xy;
xy.X = x;
xy.Y = y;
return SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), xy);
}
int main()
{
int i;
char ch,ch1;
system("cls");
ch = 66;
ch1 = 66;
gotoxy(46,8);
std::cout<<ch;
gotoxy(46,7);
std::cout<<ch;
gotoxy(30,8);
std::cout<<ch;
gotoxy(30,7);
std::cout<<ch;
gotoxy(38,7);
std::cout<<ch;
gotoxy(38,5);
std::cout<<ch;
getch();
return 0;
}
0 Comments