-
Notifications
You must be signed in to change notification settings - Fork 0
/
Check_Result.java
45 lines (42 loc) · 1.44 KB
/
Check_Result.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.File;
public class Check_Result extends Save_Location{
public static void main() throws java.io.FileNotFoundException {
Scanner sc = null;
try{
sc = new Scanner(new BufferedReader(new FileReader(file_source)));
} catch (Exception e){
System.out.println("GeneratedList.txt NOT FOUND. Have you used \"Random_Gen\" to create a number list?");
System.exit(1);
}
Scanner ob = new Scanner(System.in);
System.out.println("Which position have you reached in the announcement?");
int position = ob.nextInt();
int arr[] = new int [position];
int user[] = new int[16];
System.out.println("Enter user's numbers :");
for (int i=0; i<position; i++) {
arr[i] = Integer.parseInt(sc.nextLine().trim());
}
int x = 0;
for(int i=0; i<position;i++){
int n = ob.nextInt();
int flag = 0;
for(int j=0; j<position; j++){
if(arr[j]==n){
flag = 1;
user[x++]=arr[j];
break;
}
}
if(flag==0){
System.out.println("MISMATCH");
}
}
System.out.println("SUCCESS");
for(int i = 0; i<16; i++)
System.out.println(user[i]);
}
}