Visual Studio for C++를 사용하고 있으며 첫 번째 코드를 작성하고 있지만 '간단한'문제가 있습니다.std 핸들 사용 후 배경색을 이전 색상으로 되 돌리는 방법
코드에서 나는 각 섹션을 하나의 함수로 사용하고 있습니다. 따라서 "히트 엔터 (hit enter)"라고하는 출력 화면의 경우 화면에이를 표시하는 함수를 호출하고 있습니다. 그러나 작별 인사에서 나는 배경색이 흰색이고 텍스트가 검정색이되도록 시스템 색상을 변경했지만 "Hit Enter"기능을 계속 표시해야합니다. 하지만, 그것은 자신의 색상을 사용하기 때문에, "\ t"가 cout에있는 곳에 한 줄의 색상이 있습니다.
어떻게하지 않을까요?
#include <iostream> //Necessary for input/output
#include <string> //Necessary for constants
#include <Windows.h> //Necessary for colored text
using namespace std;
어 ... 전에는 해본 적이 없지만 섹션을 별도로 게시합니다.
system("cls");
system("color F0");
cout << "\n\n\n\n\n\n\n\t\tIt was a pleasure spending time with you, "
"User"
"!\n\n\n";
cout << "\t\t\t\350";
for (int i = 0; i < 31; i++){ cout << "\360"; }
cout << "\350\n";
cout << "\t\t\t\272";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15); //light grey
cout << " \311\315\273\332\304\277\332\304\277\332\302\277\332\277 \302 \302\332\304\277 ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 240); //Black text white bg
cout << "\272\n"
"\t\t\t\272";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15); //light grey
cout << " \272 \313\263 \263\263 \263 \263\263\303\301\277\300\302\331\303\264 ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 240); //Black text white bg
cout << "\272\n"
"\t\t\t\272";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15); //light grey
cout << " \310\315\274\300\304\331\300\304\331\304\301\331\300\304\331 \301 \300\304\331 ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 240); //Black text white bg
cout << "\272\n";
cout << "\t\t\t\350";
for (int i = 0; i < 31; i++){ cout << "\360"; }
cout << "\350\n";
그리고 히트에 대한 기능 내가 할 무엇 "밝은 회색"영역의 색상이 너무 탭이 .... 할
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7); //light grey
cout << "\n\n\n\t\t\t\332";
for (int i = 0; i < 28; i++){ cout << "\304"; }
cout << "\277\n\t\t\t\263 ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12); // Red
cout << "\3 ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 71); //light grey text with red BG
cout << "Please press the Enter";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12); // Red
cout << " \3 ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7); //light grey
cout << "\263\n\t\t\t\324";
for (int i = 0; i < 28; i++){ cout << "\315"; }
cout << "\276";
입력합니다. 죄송 합니다만 이것이 모두 끔찍한 일이라면. 이것에 새로운.
매우 유용한 답입니다! – boctulus