1、首先我们来建一稍僚敉视个c文件,打印一个hello world!且等待输入一个数字,这时候会出现一个闪烁的标。代码如下:#include <stdio.h>int main(){艘早祓胂 int i; printf("hello world!"); scanf("%d",&i);}
2、接着,我们在c文件中加入以下代码,不要忘了头文件#include <windows.h>代码如下:#include <stdi泠贾高框o.h>#include <windows.h>void HideCursor() // 用于隐藏光标{CONSOLE_CURSOR_INFO cursor_info = {1, 0}; // 第二个值为0表示隐藏光标SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);}int main(){ int i; printf("hello world!");HideCursor(); //提前隐藏 scanf("%d",&i);}
3、然后你会发现原先闪烁的光标消失啦!