zoukankan      html  css  js  c++  java
  • getch()和getchar()

    一、函数名: getch                |        函数名: getchar
    功  能: 从控制台无回显地取一个字符        |        功  能: 从stdin流中读字符
    用  法: int getch(void);                                     |        用  法: int getchar(void);
    程序例:                     |        程序例:
    #include <stdio.h>                |        #include <stdio.h>
    #include <conio.h>                |        
    int main(void)                  |        int main(void)
    {                         |        {
       char ch;                    |        int c;
       printf("Input a character:");          |        /* 注意,从stdin和行缓冲中读取来获取字符,直到你按回车,否则它不会返回. */
       ch = getche();                |        while ((c = getchar()) != ' ')  
       printf(" You input a '%c' ", ch);       |          printf("%c", c);
       return 0;                    |        return 0;
    }                         |        }

    #-----------------------------------------  这些是注释  -----------------------------------------#

    conio.h不是C标准库中的头文件。
    conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入和数据输出的函数,主要是一些用户通过按键盘产生的对应操作,比如getch()函数等等。
    包含的函数
    cgets(char *);
    cprintf(const char *, ...);
    cputs(const char *);
    cscanf(const char *, ...);  ……  [详见,百度知道的参考链接:  https://zhidao.baidu.com/question/82874213.html  -- "在c语言里#include<conio.h>是什么样的头文件,包含哪些函数?"]

    #-----------------------------------------  注释已结束  -----------------------------------------#

  • 相关阅读:
    b4a专用压缩库(国外免费)
    使用php从pc端下载apk到android手持终端并安装(比如把枪)
    快速搭建电子商务网站以及app
    【转】C#如何创建泛型类T的实例
    【转】C# 之泛型详解
    【转】Windows Server 2016 安装 IIS 服务时提示指定备用源路径
    C# json字符串转为对象
    【转】C#模拟http 发送post或get请求
    【转】Windows IIS注册asp 此操作系统版本不支持此选项 错误解决方法
    Webapi文件上传
  • 原文地址:https://www.cnblogs.com/mybo/p/6526375.html
Copyright © 2011-2022 走看看