将光标放到任意的位置

void gotoxy(int x,int y)//位置函数
{
COORD pos;
pos.X=x;
pos.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}

实现让文字显示一段时间后消失

for(int i=;i<=;i++){
gotoxy(i,);
printf("%d ",i);
Sleep();
system("cls");//清屏
}

实现限时输入

#include <iostream>
#include <cstdio>
#include <windows.h>
#include<ctime>
#include <conio.h> using namespace std; char in() {
char a;
time_t timeBegin = time();
int n=;
while(true) { //the main loop || 主循环
if(kbhit()){ //detect the keyboard || kbhit检测键盘输,如果发现了输入
a = _getch() ;
return a;
} else if(time()-timeBegin== && n==) {
cout << "Your time have "<< <<" s"<< endl;//输出倒计时
n=;
}
else if(time()-timeBegin== && n==) {
cout << "Your time have "<<<<" s"<< endl;//输出倒计时
n=;
}
else if(time()-timeBegin== && n==) {
cout << "Your time have "<< <<" s"<< endl;//输出倒计时
n=;
}
else if(time()-timeBegin>=){//时间过去30秒,进行其他操作
timeBegin = time();
n=;break;
//调用其他方法进行其他操作
}
}
}
int main(){
cout<<in();
}

最新文章

  1. 在oneAPM参加第一个项目小结
  2. Linux 终端常用快捷键
  3. ASP.NET之Cookie(坑爹的Response.Cookies.Remove)(转)
  4. RPCL(Rival Penalized Competitive Learning)在matlab下的实现
  5. python——批量下载图片
  6. Bluetooth ATT介绍
  7. ACdream 1104 瑶瑶想找回文串(SplayTree + Hash + 二分)
  8. java_stack
  9. centos 配置NFS服务器
  10. 安装npm及cnpm(Windows)
  11. 2017年AR大会上海站干货分享
  12. Wireshark使用介绍(一):Wireshark基本用法
  13. 深入理解mybatis原理, Mybatis初始化SqlSessionFactory机制详解(转)
  14. poi excel 加粗
  15. centos7.2使用rpm安装jdk8
  16. 在 windows 开发 reactNative 的环境 搭建过程 react-native-android
  17. CTF-练习平台-Misc之 Linux基础1
  18. Android Bander设计与实现 - 设计
  19. ListenableFuture in Guava
  20. JQuery实现获取多个input输入框的值,并存放在一个数组中

热门文章

  1. Hibernate-ORM:01.Hibernate恍如隔世般初见
  2. Linux 下 PHP 扩展Soap 编译安装
  3. python基础&mdash;&mdash;重访类型分类
  4. [转] Bash脚本:怎样一行行地读文件(最好和最坏的方法)
  5. What to do when Enterprise Manager is not able to connect to the database instance (ORA-28001)
  6. C#操作Excel文件(转)
  7. C++学习014函数值传递和地址传递
  8. C++学习009预处理器指令符号 # ## #@ 符号的使用
  9. DOM操作相关案例 模态对话框,简易留言板,js模拟选择器hover,tab选项卡,购物车案例
  10. node + npm 命令