ユーザーが自分の名前を入力した後に「ようこそ」を点滅させる私のコードは次のとおりです。
ユーザーが自分の名前を書いているときに「ようこそ」が点滅しません。ユーザーがEnterキーを押すと、キャレットがwhileループに入ります。すると、キャレットの位置が「ようこそ」の座標に戻り、cout が「ようこそ」を 5 色で繰り返し印刷するので、「ようこそ」が点滅しているように見えます。
しかし、プログラムの開始時に「ようこそ」が継続的に点滅することを望みます。
したがって、この質問も尋ねる可能性が高くなります-同時に2つのキャレット/カーソルを使用できますか?
#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;
int main(int argc, char** argv)
{
int x,y,i;char name[10];
textcolor(10);
x=wherex();y=wherey(); //corrdinates of caret will be stored in x & y.
cout<<"\t\t\t\tWelcome\n";
textcolor(15);
cout<<"\nEnter your name\n";
gets(name);
while(1)
{
for(i=10;i<15;i++)
{
textcolor(i);
gotoxy(x,y); //Transferring caret to the coordinates stored in x & y.
cout<<"\t\t\t\tWelcome";
Sleep(300);
}
}
return 0;
}