zoukankan      html  css  js  c++  java
  • c语言 8-1

    c语言 8-1

    1、

    #include <stdio.h>
    
    #define diff(x, y) ((x) - (y))
    
    int main(void)
    {
        int a, b;
        puts("please input two integers.");
        printf("a = "); scanf("%d", &a);
        printf("b = "); scanf("%d", &b);
        printf("diff result: %d
    ", diff(a, b));
        
        double m, n;
        puts("please input two doubles.");
        printf("m = "); scanf("%lf", &m);
        printf("n = "); scanf("%lf", &n);
        printf("diff result: %f
    ", diff(m, n));
        
        return 0;
    }

    2、

    #include <stdio.h>
    
    #define diff(x, y)  ((x > y) ? (x - y) : (y - x))
    
    int main(void)
    {
        int a, b;
        puts("please input two integers.");
        printf("a = "); scanf("%d", &a);
        printf("b = "); scanf("%d", &b);
        printf("result: %d
    ", diff(a, b));
        
        double m, n;
        puts("please input two doubles.");
        printf("m = "); scanf("%lf", &m);
        printf("n = "); scanf("%lf", &n);
        printf("result: %f
    ", diff(m, n));
        
        return 0;
    }

  • 相关阅读:
    常用css3属性
    jQuery瀑布流
    jQuery事件对象
    jQuery动画
    面向对象复习
    php 面向对象
    git
    存储数据
    ajax
    对象
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/14805587.html
Copyright © 2011-2022 走看看