JAVA basic programming exercises program [18] 18 Table Tennis

 

18 program [18] Table Tennis

Title: two table tennis team to compete, each out of three. A team of a, b, c three, Team B is x, y, z three. List of game has been determined by lot. Asking someone to the list of game players. He does not say a ratio x, c said he did not and x, z ratio, programmed to identify a list of three teams of racing.

 

package cskaoyan;

public class cskaoyan18 {
	@org.junit.Test
	public void tableTennis() {
		char A = 0;
		char B = 0;
		char C = 0;

		for (char ch = 'X'; ch <= 'Z'; ch++) {
			if (ch != 'X' && ch != 'Z') {
				C = ch;
			}
		}

		for (char ch = 'X'; ch <= 'Z'; ch++) {
			if (ch != 'X' && ch != C) {
				A = ch;
			}
		}

		for (char ch = 'X'; ch <= 'Z'; ch++) {
			if (ch != A && ch != C) {
				B = ch;
			}
		}

		System.out.println("A的对手是" + A);
		System.out.println ( "B opponent is" + B); 
}
		System.out.println ( "C opponent is" + C);
	}

 

Guess you like

Origin www.cnblogs.com/denggelin/p/11355690.html