编程计算表达式,其中a,b,c,x,y为变量,"y+a%5*(int)(x+y)/2%4",怎么编?

来源:百度知道 编辑:UC知道 时间:2024/05/03 03:22:52
编程计算表达式,其中a,b,c,x,y为变量,"y+a%5*(int)(x+y)/2%4",怎么编?

给我完整的代码,最好稍微讲讲。
用c语言编。谢谢,忘记说了不好意思
error C2296: '%' : illegal, left operand has type 'float '我输入%号它就出这个错误。

#include "stdio.h"
main()
{ int a,b,c,x,y;
float z;
scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
z=y+a%5*(int)(x+y)/2%4; /*%是求余运算,只能对整型数据进行计算*/
printf("z=%f\n",z);
}

#include <iostream>
using namespace std;
void main()
{
int a,b,c,x,y,t1;
float s;
cout<<"请分别输入a,b,c,x,y"<<endl;
cin>>a>>b>>c>>x>>y;
t1=(x+y)/2;
s=y+a%5*t1%4;
cout<<"结果为 "<<s<<endl;

}
没有什么好说的,按题目照抄就是了 INT那里应该是强制将(X+Y)/2转换成整数

那种语言呀
public class test {
public static void main(String s[]){
int a = 12;
int b;
int c;
int x = 0;
int y = 0;
int sum = 0;
sum=y+a%5*(x+y)/2%4;
System.out.println(sum);
}
}

1. a=-4. 二次函数最高点(即顶点)的公式。注意,由于有最大值,则a为负。
2.k=-1. 顶点在y轴上,则对称轴为x=0(或可以理解为定点横坐标为0)。
3.a=4或-8.先判断顶点在那个