D.5两段函数求值

来源:互联网 发布:知乎女神王诺诺是谁 编辑:程序博客网 时间:2024/06/06 02:09
/**copyright(c)2017,CSDN学院*All rights reserved.*文件名称: main.c*作    者: 杨隆胜*完成日期: 2017年8月5日*版 本 号: v1.0**问题描述:编程序,计算下面函数的值并输出(x取整型即可)
*输入描述:输入x;
*程序输出:输出y;*/#include <stdio.h>int main(){    int x,y;    printf("Please input the integer argument x:\n");    scanf("%d",&x);    if(x>=1)    {        y=x-1;    }    else    {        y=-x+1;    }    printf("The value of the funtion that caculating is %d\n",y);    return 0;}


运行结果


心得体会

在编程过程中如果出现中文字符,对同一错误,编译器将会报错两次。好像在课程中老师有讲过,但是记不得了 ,果然是好脑不如 烂笔头。

原创粉丝点击