c++ 快速读入

2020-12-13 16:40

阅读:488

标签:getch   bsp   etc   ==   div   code   return   tchar   col   

 1 inline read()
 2 {
 3     int s = 0, w = 1;
 4     char ch = getchar();
 5     while (ch ‘0 || ch > 9)    {
 6         if (ch == -)    w = -1;
 7         ch = getchar();
 8     while (ch >= 0 && ch ‘9)        {
 9             s  = s 3 + s 1 + ch - 0;
10              ch = getchar();
11     }
12     return s * w;
13 }       

调用如下

int main()
{
    int a, b;
    a = read(), b = read();
 }

 

c++ 快速读入

标签:getch   bsp   etc   ==   div   code   return   tchar   col   

原文地址:https://www.cnblogs.com/wzy-sky/p/11621302.html


评论


亲,登录后才可以留言!