"int 예 = Integer.parseInt (알 수없는 소스) 내 계산기에서 문제를 일으키고있다. 이클립스에서 꽤 새로 워서 코드 수정에 대한 제안은 훌륭 할 것이다."int yes = Integer.parseInt (sc.nextLine());"
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter your first number");
int nr1 = Integer.parseInt(sc.nextLine());
System.out.println("Enter your second number");
int nr2 = Integer.parseInt(sc.nextLine());
System.out.println("Enter your sign (+ , - , /, *)");
int yes = Integer.parseInt(sc.nextLine());
int ans =0;
int j = 0;
int reset =j;
java.lang.String anvin = sc.nextLine();
if(anvin.equalsIgnoreCase("+")) {
ans = nr1 + nr2;
}
else if(anvin.equalsIgnoreCase("-")) {
ans = nr1 - nr2;
}
else if(anvin.equalsIgnoreCase("*")) {
ans = nr1 * nr2;
}
else if(anvin.equalsIgnoreCase("/")) {
ans = nr1/nr2;
System.out.println(ans);
}
if(anvin.equalsIgnoreCase("yes")) {
return;
}
}
}
그 문제가 무엇인가? –
출력 결과를 보면 세 번째 줄은 * 기호 *라고 생각하십니까? '+, -, /, *'정수들이 – blgt
@MindPeace 있습니다 지금은하지 않습니다 내가 입력 할 때 질문의 제목에 그래서 ... –