首页 > 电脑

求救!二元运算符操作数类型是哪一步错了?

更新时间2018-03-06 19:41:58

import java.util.Scanner;

public class text2{

public static void main(String[] args){

Scanner in=new Scanner(System.in);

System.out.println("---猜拳游戏---");

System.out.println("请出拳(1.石头 2.剪刀 3.布)");

int person=in.nextInt();

int computer=(int)(Math.random()*3)+1;

String game="拳头";//这是给人做一个标记

String game1="拳头";//这是电脑

switch(person){

case 1:

game="石头";

break;

case 2:

game="剪刀";

break;

case 3:

game="布";

break;

}

switch(computer){

case 1://23行

game1="石头";

break;

case 2:

game1="剪刀";

break;

case 3:

game1="布";

break;

}

if(person==computer){

System.out.println("你出的是:"+game+"电脑跟你出的一样呢!---平局");

}else if(person==1&&computer==3||person==2&&computer==1||person=3&&computer==2){

System.out.println("你出的是:"+game+"电脑出的是:+game1+很遗憾!你输了-_-");

}else{

System.out.println("恭喜你,你赢了!你出的是:"+game+"电脑出的是:"+game1);

}

 

}

}

求救!二元运算符操作数类型是哪一步错了?

语法上,你的if中将==写成=了

求救!二元运算符操作数类型是哪一步错了?

另外,检查你的逻辑关系,判断要加()的

相关标签:运算

上一篇:华为nowa2plus和mate10哪个好

下一篇:英特尔酷睿2双核e7500,能不能升级win7升级之后能不能玩英雄联盟,会不会卡