谁能帮我看看是怎么回事啊,怎么switch()老是叉啊为啥呢谢谢啦,万分感谢
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了谁能帮我看看是怎么回事啊,怎么switch()老是叉啊为啥呢谢谢啦,万分感谢相关的知识,希望对你有一定的参考价值。
public static void main(String[] args)
java.util.Scanner input = new java.util.Scanner(System.in);
double a= input.nextDouble();
double b= input.nextDouble();
double c= input.nextDouble();//定义三边,并赋值
double s1,s2;
double x= Math.max(Math.max(a,b),c);
switch (x)
case a:
s1=b;s2=c;break;
case b:
s1=a;s2=c;break;
case c:
s1=a;s2=b;break;
if(s1+s2<=x)
System.out.printf("%f,%f和%f不可以组成三角形\n",a,b,c);
else if(1*s1+s2*s2 > x*x) System.out.println("锐角");
else if(1*s1+s2*s2 = x*x) System.out.println("直角");
else if(1*s1+s2*s2 < x*x) System.out.println("钝角");
即使把case的内容用“”括起来也还是 switch (x)这里错误,怎么改正呢?谢谢
追答public static void main(String[] args)
java.util.Scanner input = new java.util.Scanner(System.in);
double a= input.nextDouble();
double b= input.nextDouble();
double c= input.nextDouble();//定义三边,并赋值
double s1=0,s2=0;//赋初值
int i;
double x= Math.max(Math.max(a,b),c);
if(Math.max(Math.max(a,b),c)==a)//将结果转化一下
i=1;
else if(Math.max(Math.max(a,b),c)==b)
i=2;
else
i=3;
switch (i)
case 1:
s1=b;s2=c;break;
case 2:
s1=a;s2=c;break;
case 3:
s1=a;s2=b;break;
if(s1+s2 x*x) System.out.println("锐角");
else if(1*s1+s2*s2 == x*x) System.out.println("直角");
else if(1*s1+s2*s2 < x*x) System.out.println("钝角");
if(Math.max(Math.max(a,b),c)==c)你好,你是少打了这条了吧?不知道阁下是否测试过?我试了试,似乎还是原先的地方有错误switch (i),阁下再帮忙看看,谢谢
追答不是有个else么,表达式不等于a,不等于b,就只能是C,所以就可以了
代码我是运行好之后才发的,这点规矩我还是懂的
switch (x)
case a:
s1=b;s2=c;break;
case b:
s1=a;s2=c;break;
case c:
s1=a;s2=b;break;
//是这里加一个这个大括号吗?怎么还是错啊,怎么改正呢?谢谢
怎么改正呢?谢谢
追答1、switch是不能用double来比较的,只能用于int,short,byte,char,后来的JDK版本增加了这四个对应的封装类
2、else if(1*s1+s2*s2 = x*x) System.out.println("直角");这一句,if条件中不应该用=,而是用==
3、这一连串的if、else if最好放在switch句外面,否则可能不会执行的,这是我猜得,具体LZ可以试试的
谁能帮我翻译下(有分奖赏)
第一句:
Nowadays, most of the hydrophobic associative polymers consist of an ionic framework with a non-ionic hydrophobic unite, a non-ionic framework with an ionic hydrophobic unite or a non-ionic framework with a nonionic hydrophobic unite; the research of an ionic
framework with an ionic hydrophobic unite are relatively scarce
第二句:
There is no special equation to calculate the molecular weight of a hydrophobic associative water-soluble polymer,so we use for reference GB12005.1-89 (GB, Guo jia Biao zhun) and GB12005.10-92 to calculate the average molecular weight of the hydrophobic associative watersoluble polymer synthesized in this paper.
第三句:
Rheology:
Concentrated stock polymer solutions were prepared by dissolving appropriate amounts of the polymer with distilled water in a 500ml flask. Gentle magnetic agitation was applied after 1 day of
prehydration. The final solutions of the desired concentration were made up in 50ml conical flasks by diluting the stock solutions with distilled water and mixed in a thermostatic water bath shaker
(25 °C) for about 12 h. Before measurements, polymer solutions were
left without agitation for at least 1 day to reach equilibrium.
The viscosity was measured at 25±0.1 °C using the Brookfield
DV-III programmable rheometer (Hebei Chengde Lab Instrument [China]).
1如今,大多数的疏水性聚合物组成联想的离子框架,非离子型疏水团结起来,非离子型框架离子疏水团结或非离子型框架,非离子型疏水团结;的研究离子
框架离子疏水团结是相对稀缺
2有没有特殊的方程来计算分子量的疏水联想水溶性聚合物,因此,我们借鉴GB12005.1 - 89 ( GB的,郭嘉标准)和GB12005.10 - 92来计算平均相对分子质量疏水联想水溶性高分子合成方法。
3流变:
浓缩股票聚合物溶液准备解散适当数额的聚合物与蒸馏水的五○○毫升瓶。温柔磁性适用于搅拌后1天
prehydration 。最后的解决方案所需的浓度是在锥形烧瓶五十〇毫升由稀释的股票解决方案与蒸馏水混合在恒温水浴摇床
( 25 ℃ )大约12小时在测量,聚合物的解决办法
没有搅拌至少1天,以达到平衡。
粘度测量在25 ± 0.1 ℃的使用布鲁克菲尔德
变分三可编程流变仪(河北承德实验室仪器[中国] )
以上是关于谁能帮我看看是怎么回事啊,怎么switch()老是叉啊为啥呢谢谢啦,万分感谢的主要内容,如果未能解决你的问题,请参考以下文章
CPU使用老是100% 进程里services.exe 占用CPU非常大, 是怎么回事
我在安装Linux的时候,USB启动,进去一会就这样了,谁能帮我看看怎么解决?