Created
July 16, 2011 03:23
-
-
Save 6LYTH3/1085965 to your computer and use it in GitHub Desktop.
ACM_Problem E
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import java.io.File; | |
import java.util.Scanner; | |
public class Relation { | |
public static void main(String[] args) throws Throwable { | |
File file = new File("txt"); | |
Scanner sc = new Scanner(file); | |
String Op[] = new String[] { ">", ">=", "<", "<=", "==", "!="}; | |
int count = 1; | |
while (true) { | |
int num1 = sc.nextInt(); | |
String OpInput = sc.next(); | |
int num2 = sc.nextInt(); | |
if(OpInput.equals("E")) break; | |
for (int i = 0; i < 6; i++) { | |
if (OpInput.equals(Op[i])) { | |
System.out.print("case " + count++ + ": "); | |
switch (i) { | |
case 0:System.out.println(num1 > num2); | |
break; | |
case 1: System.out.println(num1 >= num2); | |
break; | |
case 2:System.out.println(num1 < num2); | |
break; | |
case 3: System.out.println(num1 <= num2); | |
break; | |
case 4:System.out.println(num1 == num2); | |
break; | |
case 5:System.out.println(num1 != num2); | |
break; | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment