Language: C

#include<stdio.h>

//関数プロトタイプ宣言
void diceRoll(int *d,char *r);

int main(){
	int dice[6];	//サイコロ
	int q;			//質問の数
	int up;			//サイコロの上面
	int front;		//サイコロの前面
	
	//サイコロの作成
	for(int i = 0;i < 6;i++){
		scanf("%d",&dice[i]);
	}
	//質問の数の入力
	scanf("%d",&q);
	
	for(int i = 0;i < q;i++){
		//上面と前面の入力
		scanf("%d %d",&up,&front);
		
		//サイコロの上面が入力されたものと違うとき
		if(dice[0] != up){
			switch(up){
				//入力された上面が前面にあったとき
				case dice[1]:
					diceRoll(dice,"N");
					break;
				//右面にあったとき
				case dice[2]:
					diceRoll(dice,"W");
					break;
				//左面にあったとき
				case dice[3]:
					diceRoll(dice,"E");
					break;
				//後面にあったとき
				case dice[4]:
					diceRoll(dice,"S");
					break;
				//底面にあったとき
				case dice[5]:
					diceRoll(dice,"NN");
					break;
			}
		}
		
		//サイコロの前面が入力されたものと違うとき
		if(dice[0] != up){
			switch(up){
				//入力された前面が右面にあったとき
				case dice[2]:
					diceRoll(dice,"R");
					break;
				//左面にあったとき
				case dice[3]:
					diceRoll(dice,"L");
					break;
				//後面にあったとき
				case dice[4]:
					diceRoll(dice,"RR");
					break;
			}
		}
		
		//右面を表示
		printf("%d\n",dice[2]);
	}
	
	return 0;
}

void diceRoll(int *d,char *r){
	int x;	//入れ替え用変数
	for(int i = 0;r[i] != '\0';i++){
		switch(r[i]){
			//右に転がす
			case 'E':
				x = d[0];
				d[0] = d[3];
				d[3] = d[5];
				d[5] = d[2];
				d[2] = x;
				break;
			//奥に転がす
			case 'N':
				x = d[0];
				d[0] = d[1];
				d[1] = d[5];
				d[5] = d[4];
				d[4] = x;
				break;
			//手前に転がす
			case 'S':
				x = d[0];
				d[0] = d[4];
				d[4] = d[5];
				d[5] = d[1];
				d[1] = x;
				break;
			//左に転がす
			case 'W':
				x = d[0];
				d[0] = d[2];
				d[2] = d[5];
				d[5] = d[3];
				d[3] = x;
				break;
			//右に９０度回す
			case 'R':
				x = d[1];
				d[1] = d[2];
				d[2] = d[4];
				d[4] = d[3];
				d[3] = x;
				break;
			//左に９０度回す
			case 'L':
				x = d[1];
				d[1] = d[3];
				d[3] = d[4];
				d[4] = d[2];
				d[2] = x;
				break;
		}
	}
}



Compiler output:
main.c: In function 'main':
main.c:27:33: error: case label does not reduce to an integer constant
   27 |                                 case dice[1]:
      |                                 ^~~~
main.c:31:33: error: case label does not reduce to an integer constant
   31 |                                 case dice[2]:
      |                                 ^~~~
main.c:35:33: error: case label does not reduce to an integer constant
   35 |                                 case dice[3]:
      |                                 ^~~~
main.c:39:33: error: case label does not reduce to an integer constant
   39 |                                 case dice[4]:
      |                                 ^~~~
main.c:43:33: error: case label does not reduce to an integer constant
   43 |                                 case dice[5]:
      |                                 ^~~~
main.c:53:33: error: case label does not reduce to an integer constant
   53 |                                 case dice[2]:
      |                                 ^~~~
main.c:57:33: error: case label does not reduce to an integer constant
   57 |                                 case dice[3]:
      |                                 ^~~~
main.c:61:33: error: case label does not reduce to an integer constant
   61 |                                 case dice[4]:
      |                                 ^~~~