|
查看: 1152|回复: 6
|
请问有谁会以C or C++ or other language把这个equation来写出来?
[复制链接]
|
|
|
Question:
A software runs on a language called "Unique", I need to convert the equation into a programming language that "Unique" use. The equation is:
Output = 12 + ((93 * a / 2 + 432*b)/129+x) x2
My derivation:
I assume:
Output = Failed or Passed (either pass or fail depending on the result)
a = vibration level. High = 10, Mid = 5, Low = 1
b = Noise injection. High = 10, Mid = 5, Low = 1
x = Temperature. High = 52C, Mid = 35C, Low = 1C.
i) If a = 10, b = 5, x = 52C. Output = Failed
ii). If a = 1 or <5, b = 5, x = 35C or 1C. Output = Passed
Based on the above assumption. If I would like to use C or C++ programming language to convert the above equation. Anyone can help to do a simple C programming language to help to write? |
|
|
|
|
|
|
|
|
|
|
发表于 21-2-2009 02:16 PM
|
显示全部楼层
回复 1# corsiar74 的帖子
请自己试试, 这里没有免费的帮你做tutorial的人...
我已经不写C++/C 很久了, 不过JAVA跟它一样作法(logic 一样) |
|
|
|
|
|
|
|
|
|
|
发表于 21-2-2009 02:22 PM
|
显示全部楼层
|
out put 多少是pass,多少是fail?? |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 21-2-2009 02:26 PM
|
显示全部楼层
Output >10K = Failed
Output <10K = Passed.
请帮帮我吗? 因为我没有programming的底...在此先谢谢大家....
原帖由 张君宝 于 21-2-2009 02:22 PM 发表 
out put 多少是pass,多少是fail?? |
|
|
|
|
|
|
|
|
|
|
发表于 22-2-2009 12:39 PM
|
显示全部楼层
原帖由 corsiar74 于 21-2-2009 02:26 PM 发表 
Output >10K = Failed
Output
我不知道你是怎样算到10k的=.=
你的两个例子我都算到100多
failed那个156.xx
pass那个116.xx
随便做的,不对不要骂我
我没有收你钱的=.=
#include<stdio.h>
void main()
{
float vibr;
float noise;
float temp;
float result;
printf("\nKey in vibration level:");
scanf("%f",&vibr);
printf("\nKey in noise injection:");
scanf("%f",&noise);
printf("\nKey in temperatue: (in celcius)");
scanf("%f",&temp);
result=12+((93*vibr/2+432*noise)/129+temp)*2;
printf("Result is :%.2f\n",result);
}
[ 本帖最后由 张君宝 于 22-2-2009 12:42 PM 编辑 ] |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 22-2-2009 03:09 PM
|
显示全部楼层
谢谢你张君宝!!
原帖由 张君宝 于 22-2-2009 12:39 PM 发表 
我不知道你是怎样算到10k的=.=
你的两个例子我都算到100多
failed那个156.xx
pass那个116.xx
随便做的,不对不要骂我
我没有收你钱的=.=
#include
void main()
{
float vibr;
float n ... |
|
|
|
|
|
|
|
|
|
|
发表于 23-2-2009 10:45 PM
|
显示全部楼层
原帖由 corsiar74 于 22-2-2009 03:09 PM 发表 
printf("Result is :%.2f\n",result);
你拿这个去交货也可以吗? |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|