• 2021-04-14
    下列给定程序中,函数fun的功能是进行数字字符转换。若形参ch中是数字字符'0'~'9',则将'0'转换成'9','1'转换成'8','2'转换成'7',……,'9'转换成'0';若是其他字符则保持不变;并将转换后的结果作为函数值返回。


    #include
    请填空(1) fun(char ch)
    { if (ch>='0' &&请填空(2) )
    return '9'- (ch- 请填空(3) ) ;
    return ch ;
    }
    main()
    { char c1, c2;
    printf("\nThe result :\n");
    c1='2'; c2 = fun(c1);
    printf("c1=%cc2=%c\n", c1, c2);
    c1='8'; c2 = fun(c1);
    printf("c1=%cc2=%c\n", c1, c2);c1='a';c2 = fun(c1);
    printf("c1=%cc2=%c\n", c1, c2);
    }