zoukankan      html  css  js  c++  java
  • 实用技巧之while里面使用getchar或sleep函数

                                       我们经常需要打印一些变量的取值来调试程序,使用while(1)是常用的手段。

                                      

                  while (1)
            {
                char letter = getchar();
                printf("test_point is %d \t\n", test_point);
                printf("test_point is %f \t\n", test_point);
                //printf("右移一些位数%d \t\n", (test_point & 0xff00) >> 16);
                //printf("hello world\n");
                //scanf("%d", &normal_point);
                printf(" letter is %c\n", letter);
            }
    
    
    
    
                     while (1)
            {
            
                printf("test_point is %d \t\n", test_point);
                printf("test_point is %f \t\n", test_point);
                Sleep(1000);
            }

                         

    #include "common.h"
    #include <stdio.h>
    #include <stdlib.h>
     
    static float Mathematical_modeling = 0;
    static int   capacitance_modeling  = 0;
    static int   value = 0;
    
    int main()
    {
        while (1)
        {
            value = getchar();
            switch (value)
            {
               case '1':
                   printf("人工智障\n");
                   break;
               case '2':
                   printf("Vim实用技巧\n");
                   break;
               case '3':
                   printf("嵌入式linux\n");
               case '4':
                   printf("linux gpio\n");
                   break;
               case '5':
                   printf("linux DMA\n");
                   break;
               case '6':
                   printf("linux KEY POLL\n");
               case '7':
                   printf("Linux I2C \n");
               case '8':
                   printf("Linux RTOS\n");
                   break;
               case '9':
                   printf("Linux Task\n");
                   break;
            }
            printf("value is %c\n", value);
        }
        return 0;
    } 

                                        

    一勤天下无难事。
  • 相关阅读:
    JavaScript 基础第七天(DOM的开始)
    JavaScript 基础第六天
    JavaScript 基础第五天
    JavaScript 基础第四天
    JavaScript 基础第三天
    JavaScript 基础第二天
    观《幸福终点站》有感
    山东移动2014校园招聘笔试
    Genymotion虚拟Android不能联网的一种解决方法
    关于Thinkpad E420双显卡驱动安装和切换的问题
  • 原文地址:https://www.cnblogs.com/nowroot/p/12363212.html
Copyright © 2011-2022 走看看