编辑代码

#include <stdio.h>
int main()
{
	int x=0,y=0,temp=0;
	printf("请输入一个整数:\n");
	scanf("%d",&temp);
    x=temp;

	if(temp<0)
    {x=x*x+2;}
    if(temp>=0 && temp<5)
    {x=x+1;}
    if(temp>=5)
    {x=x*2;}

    printf("\nf(x)的值为:%d",x);


    return 0;

}