zoukankan      html  css  js  c++  java
  • 2011无代码无意义 test_gets_scanf连用 等

    引:这里代码的意义就是 scanf gets 之间连用,注意清除缓冲

    #include "stdafx.h"

    #include "test_.h"

    void test_单纯的scanf()

    {

          printf("case 1 please\n please input \"123abc \n");

          int I_a[10];

          char Ch_a[10];

          scanf("%d%s",I_a,Ch_a);

          printf("test Ch_a: %s \n",Ch_a);

          printf("解说:单行scanf ,除了char* ,是不能分离的\n");

          //竟然可以分离出来,实践就是不一样

    }

    //2

    void  test_gets_scanf连用()

    {

          printf("\n 情形:now test scanf gets\n");

          int I_b;

          double D_b;

          char Ch_b[10];

          printf("please input num: \n");

          scanf("%d",&I_b);

          fflush(stdin);//很重要,注释了话,gets会吃掉回车。

          printf("input string: \n");

          gets(Ch_b);

          printf("input double :\n");

          scanf("%lf",&D_b);//lf...看来vs 平台很聪明。

          printf("test end\n");

    }

    void test_scanf()

    {

    test_gets_scanf连用();

          //todoL 基础的,printf 的格式控制符。。。整数的变形最多(l, , h,u;) (d,f)

         

          //

          getchar();

          getchar();

    }

  • 相关阅读:
    learning scala view collection
    scala
    learning scala dependency injection
    learning scala implicit class
    learning scala type alise
    learning scala PartialFunction
    learning scala Function Recursive Tail Call
    learning scala Function Composition andThen
    System.Threading.Interlocked.CompareChange使用
    System.Threading.Monitor的使用
  • 原文地址:https://www.cnblogs.com/titer1/p/2304010.html
Copyright © 2011-2022 走看看