Skip to content

Commit

Permalink
[Feat.] Add function init_console()
Browse files Browse the repository at this point in the history
  • Loading branch information
hui-shao committed Nov 29, 2020
1 parent ac370b2 commit e1ef087
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Cpp/Screen-Resolution/Screen-Resolution.cpp
Original file line number Diff line number Diff line change
@@ -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结构体变量
Expand All @@ -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]);
Expand All @@ -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;
Expand Down

0 comments on commit e1ef087

Please sign in to comment.