微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 Visual Studio 中为选定文本添加闪烁效果、文本颜色和背景文本颜色

如何解决在 Visual Studio 中为选定文本添加闪烁效果、文本颜色和背景文本颜色

我是 C++ 的新手。我目前正在将我的主菜单(即 Turbo C++ 代码)转换为 Visual Studio。我已经在 Turbo C++ 中常用的一些函数中找到了解决方案。我的主要问题是,我不知道如何手动突出显示某些选定的文本。我曾经玩过 textcolor(COLOR + BLINK);因为我们的教授要求我们这样做,但似乎它在 Visual Studio 中不起作用。我也试过系统(“颜色XY”),但它突出显示了lmao的所有文本。到目前为止,这是我转换后的代码(已修剪)。

Here's the image that I want to display in Visual Studio

//| Header
#include <iostream>
#include <conio.h>
#include <process.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <Windows.h>
#define clrscr(); system("cls");
#define getch(); _getch()

using namespace std;

void gotoxy(int x,int y)
{
    COORD coord;
    coord.X = x;
    coord.Y = y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}

void clreol(void)
{
    cin.clear();
    cin.ignore();
}

//Refresher Loop Variable
int refresh = 1;

char main_input;
char s_input;
char se_input;
char l_input;
char l_option;
char a_input;
int trigger;

//|-------------------------------------------------------------(Main Lobby)-
//---------------------------------------------------------------------------
int main(void) {
clrscr();

while(refresh == 1)
do {
clrscr();

gotoxy(30,8);  
system("Color 80");
cout << "      Main Menu      ";


gotoxy(30,10); system("Color D7");
cout << "A"; 
system("Color 07");  cout << " - Sequence";

gotoxy(30,11); system("Color 17");
cout << "B";    
system("Color 07"); cout << " - Selection";

gotoxy(30,12); system("Color 27");
cout << "C";    
system("Color 07"); cout << " - Iteration";

gotoxy(30,13); system("Color 67");
cout << "D";    
system("Color 07"); cout << " - Arrays final exam   ";

gotoxy(30,14); system("Color 47");
cout << "E";    
system("Color 07"); cout << " - Exit";

gotoxy(30,16);
    cout << "Enter your choice: ";
            cin >> main_input;

switch(main_input) {
    case 'A': sequence();
    break;

    case 'B': selection();
    break;

    case 'C': loops();
    break;

    case 'D': arrays();
    break;

    case 'E':
        exit(0);
    break;
} // End of switch

} while(refresh == 1); // End of do while

getch();

}

谢谢:)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。