Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class MsgBox{
- public:
- static void gotoxy(short x, short y){
- COORD pos = {x,y};
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
- }
- static void showBox(int x1, int y1, int x2, int y2,string n){
- int centerx, centery;
- centerx=x1+5;
- centery=y1+3;
- for(int x=x1;x<=x2;x++){
- gotoxy(x,y1);
- cout<<(char)205;
- gotoxy(x,y2);
- cout<<(char)205;
- }
- for(int y=y1;y<=y2;y++){
- gotoxy(x1,y);
- cout<<(char)186;
- gotoxy(x2,y);
- cout<<(char)186;
- }
- gotoxy(centerx,centery);
- cout<<n;
- }
- static void showBox(int x1, int y1, int x2, int y2,string n,string a){
- int centerx, centery;
- centerx=x1+5;
- centery=y1+3;
- for(int x=x1;x<=x2;x++){
- gotoxy(x,y1);
- cout<<(char)205;
- gotoxy(x,y2);
- cout<<(char)205;
- }
- for(int y=y1;y<=y2;y++){
- gotoxy(x1,y);
- cout<<(char)186;
- gotoxy(x2,y);
- cout<<(char)186;
- }
- gotoxy(x1,y1);
- cout<<a;
- gotoxy(centerx,centery);
- cout<<n;
- }
- };
- #include <windows.h>
- #include <iostream>
- #include "MsgBox.h"
- using namespace std;
- void gotoxy(short x, short y){
- COORD pos = {x,y};
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
- }
- int main(){
- system("color 47");
- MsgBox::showBox(10,5,70,20,"Hello");
- system("pause>nul");
- system("cls");
- MsgBox::showBox(10,5,70,20,"Hello","Info Box");
- system("pause>nul");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement