急!!!高难度c语言编程题,高手请进帮忙!!! 10

有一函数:{x(-5<x<0)y={x-1(x=0){x=1(0<x<10)编写一程序,要求输入x的值(x为整型),输出y的值。分别用(1)if语句(2)switch语句... 有一函数: { x (-5<x<0)
y={ x-1 (x=0)
{ x=1 (0<x<10)
编写一程序,要求输入x的值(x为整型),输出y的值。
分别用(1)if语句
(2)switch语句
展开
 我来答
liujiekkk123
2008-03-18 · 超过83用户采纳过TA的回答
知道小有建树答主
回答量:284
采纳率:0%
帮助的人:240万
展开全部
很简单

#include<stdio.h>
void main()
{
int ix,iy;
printf("please input the data of x:");
scanf("%d",&ix);
if(x<-5&&x>0)
printf("the y is :%d",ix);
if(x==0)
{
iy=ix-1;
printf("the y is:%d"&iy);
}
if(x<0&&x<10)
printf("the y is: 1");
printf("input any key to quit!");
gech();
}
这是if的
#include<stdio.h>
void main()
{
int ix,iy,entrance;
printf("input the x:");
scanf("%d",ix);
if(x<-5&&x>0)
entrance=1;
if(x==0)
{
entrance=2;
}
if(x<0&&x<10)
entrance=3;
switch(entrance)
case 1: printf("the y is :%d",ix);break;
case 2: printf("the y is :%d,ix-1");break;
case 3: printf("the y is : 1");break;
printf("input any key to quit!");
getch();

}
就是这个了。
50573750
2008-03-18 · TA获得超过976个赞
知道大有可为答主
回答量:1800
采纳率:100%
帮助的人:0
展开全部
switch(x%1)
{
case '-4':case '-3':case ''...
case '0': if(x==0)。。。

}
你知道了吧!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
dabaixiangzi
2008-03-18
知道答主
回答量:12
采纳率:0%
帮助的人:0
展开全部
#include<stdio.h>
void main(){
int x,y;
printf("input x\n");
scanf("%d",&x);
if(x<10 && x >0)
y = x+1;
else if(x == 0)
y = x-1;
else if(x> -5 && x<0)
y = x;
printf("y=%d",x);
}
swith版的楼上已给出了大意,你可以自己编一下。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
笨瓜007
2008-03-19 · TA获得超过426个赞
知道小有建树答主
回答量:610
采纳率:0%
帮助的人:468万
展开全部
问题什么意思?

函数在哪了?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
wuruimao
2008-03-18 · 超过14用户采纳过TA的回答
知道答主
回答量:120
采纳率:0%
帮助的人:31.9万
展开全部
什么意思啊。大括号乱括
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
靖蓄宇辰锟
2019-11-04 · TA获得超过3733个赞
知道大有可为答主
回答量:3116
采纳率:32%
帮助的人:456万
展开全部
很简单
#include<stdio.h>
void
main()
{
int
ix,iy;
printf("please
input
the
data
of
x:");
scanf("%d",&ix);
if(x<-5&&x>0)
printf("the
y
is
:%d",ix);
if(x==0)
{
iy=ix-1;
printf("the
y
is:%d"&iy);
}
if(x<0&&x<10)
printf("the
y
is:
1");
printf("input
any
key
to
quit!");
gech();
}
这是if的
#include<stdio.h>
void
main()
{
int
ix,iy,entrance;
printf("input
the
x:");
scanf("%d",ix);
if(x<-5&&x>0)
entrance=1;
if(x==0)
{
entrance=2;
}
if(x<0&&x<10)
entrance=3;
switch(entrance)
case
1:
printf("the
y
is
:%d",ix);break;
case
2:
printf("the
y
is
:%d,ix-1");break;
case
3:
printf("the
y
is
:
1");break;
printf("input
any
key
to
quit!");
getch();
}
就是这个了。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(4)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式