首页 > 其他 > 详细

_getch()函数的一些使用方法

时间:2020-05-05 01:23:31      阅读:85      评论:0      收藏:0      [点我收藏+]

转载自https://blog.csdn.net/qq_44833767/article/details/92797978

我们一般所使用的 getchar() 函数在读入一个字符时 必须按一下 enter 键,该代码才会继续运行;
但是 getch() 函数读入一个字符时 不用 enter 代码会继续跑;

#include <iostream>
#include <conio.h>
#include <stdio.h>
#include "Person.h"
#include <stdlib.h>
using namespace std;

int main()
{
    
    int n = 1;
    while (1) {
        for (int i = 0; i < n; i++) {
            cout << * ;
        }
        //cout << endl;
        n++;
        _getch();
        system("cls");  //清屏操作
    }

    return 0;
}

 

_getch()函数的一些使用方法

原文:https://www.cnblogs.com/Es-war/p/12829040.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!