From e1ef08732d66e3572455631e6632498f4e1ca7aa Mon Sep 17 00:00:00 2001 From: hui-shao Date: Sun, 29 Nov 2020 14:22:16 +0800 Subject: [PATCH] [Feat.] Add function init_console() --- Cpp/Screen-Resolution/Screen-Resolution.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Cpp/Screen-Resolution/Screen-Resolution.cpp b/Cpp/Screen-Resolution/Screen-Resolution.cpp index a08047c..887574b 100644 --- a/Cpp/Screen-Resolution/Screen-Resolution.cpp +++ b/Cpp/Screen-Resolution/Screen-Resolution.cpp @@ -1,5 +1,14 @@ #include "Screen-Resolution.h" +void init_console() +{ + SetConsoleTitle("Screen-Resolution v0.1.2 by Hui-Shao"); + std::cout << "\nIniting..." << std::endl; + system("mode con cols=90 lines=30"); + system("color 9f"); + std::cout << " " << std::endl; +} + void set_resolution(int width, int height) { //定义DEVMODE结构体变量 @@ -22,8 +31,8 @@ void set_resolution(int width, int height) int main(int argc, char** argv) { + init_console(); int w, h; - std::cout << "" << std::endl; if (argc == 3) { w = atoi(argv[1]); @@ -32,6 +41,7 @@ int main(int argc, char** argv) } else { + system("color cf"); std::cout << "Invalid arguments, have nothing to do...\nUsage: [Width] [Height]" << std::endl; } std::cout << "\nPress any key to exit..." << std::endl;