码迷,mamicode.com
首页 > 编程语言 > 详细

c++ get keyboard event

时间:2017-10-14 17:10:32      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:bre   iostream   windows   get   art   log   div   sdn   printf   

#include <string>
#include <iostream>
#include "windows.h"
#include <conio.h>
#include <time.h>
#include "stdio.h"
using namespace std;

int main()
{
    char old;
    while(1){
        char c = getch();
        if (c == q){
            char cc;
            do{
                system("cls");
                printf("are you sure to quit?(y/n)");
                cc = getch();
                printf("++%c",cc);
            }
            while(cc != y && cc !=n);
            printf("q cc=%c\n", cc);
            if(cc == y){
                break;
            }
            else{
                printf("q_old = %c\n", old);
            }
        }
        system("cls");
        printf("%c\n", c);
        old = c;
        printf("old=%c\n",old);
    }
    return 0;
}

 http://blog.csdn.net/zz457887107/article/details/6612034

c++ get keyboard event

标签:bre   iostream   windows   get   art   log   div   sdn   printf   

原文地址:http://www.cnblogs.com/fish7/p/7667024.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!