Language: C++

#include <iostream>
using namespace std;

class Dice{
	
	int _num[6];
public:
	void set(int num[6]){
		for(int i=0;i<6;i++){
            _num[i] = num[i];
        }
    }
    void printTop(){
        cout << _num[0] << endl;
    }
    void N(){
        int buf = _num[0];
        _num[0] = _num[1];
        _num[1] = _num[5];
        _num[5] = _num[4];
        _num[4] = buf;
    }
    void S(){
        int buf = _num[0];
        _num[0] = _num[4];
        _num[4] = _num[5];
        _num[5] = _num[1];
        _num[1] = buf;
    }
    void W(){
        int buf = _num[0];
        _num[0] = _num[2];
        _num[2] = _num[5];
        _num[5] = _num[3];
        _num[3] = buf;
    }
    void E(){
        int buf = _num[0];
        _num[0] = _num[3];
        _num[3] = _num[5];
        _num[5] = _num[2];
        _num[2] = buf;
    }
};
 
 
 
 
int main(void){
    int num[6];
    for(int i=0;i<6;i++){
        int n;
        cin >> n;
        num[i] = n;
    }
     
    Dice d;
    d.set(num);
     
    string txt;
    cin >> txt;
     
    while(txt.size()>0){
        char c = txt[0];
        txt = txt.substr(1);
         
        if(c == 'N')
            d.N();
        else if(c == 'S')
            d.S();
        else if(c == 'W')
            d.W();
        else if(c == 'E')
            d.E();
    }
     
    d.printTop();
 
}



#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdio>
using namespace std;
 
class Dice{
public:
  //Dice();
  void input();
  void routen(char ch);
  int upnum(){
    return d[0];
  }
private:
  int tmp[6], d[6];
};
 
void Dice::input(){
  for(int i=0;i<6;i++){
    cin >> d[i];
  }
}
 
void Dice::routen(char ch){
  for(int i=0;i<6;i++){
    tmp[i] = d[i];
  }
  switch(ch){
    case 'E':
      d[0] = tmp[3];
      d[2] = tmp[0];
      d[3] = tmp[5];
      d[5] = tmp[2];
    break;
    case 'W':
      d[0] = tmp[2];
      d[2] = tmp[5];
      d[3] = tmp[0];
      d[5] = tmp[3];
    break;
    case 'S':
      d[0] = tmp[4];
      d[1] = tmp[0];
      d[5] = tmp[1];
      d[4] = tmp[5];
    break;
    case 'N':
      d[0] = tmp[1];
      d[1] = tmp[5];
      d[5] = tmp[4];
      d[4] = tmp[0];
    break;
  };
}
 
int main(){
  Dice dice;
  string str;
 
  dice.input();
  cin >> str;
 
  for(int i=0;i<str.size();i++){
    dice.routen(str[i]);
  }
 
  cout << dice.upnum() << endl;
 
  return 0;
}

Compiler output:
a.cc:92:7: error: redefinition of 'class Dice'
   92 | class Dice{
      |       ^~~~
a.cc:4:7: note: previous definition of 'class Dice'
    4 | class Dice{
      |       ^~~~
a.cc:104:6: error: no declaration matches 'void Dice::input()'
  104 | void Dice::input(){
      |      ^~~~
a.cc:104:6: note: no functions named 'void Dice::input()'
a.cc:4:7: note: 'class Dice' defined here
    4 | class Dice{
      |       ^~~~
a.cc:110:6: error: no declaration matches 'void Dice::routen(char)'
  110 | void Dice::routen(char ch){
      |      ^~~~
a.cc:110:6: note: no functions named 'void Dice::routen(char)'
a.cc:4:7: note: 'class Dice' defined here
    4 | class Dice{
      |       ^~~~
a.cc:142:5: error: redefinition of 'int main()'
  142 | int main(){
      |     ^~~~
a.cc:49:5: note: 'int main()' previously defined here
   49 | int main(void){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:146:8: error: 'class Dice' has no member named 'input'
  146 |   dice.input();
      |        ^~~~~
a.cc:150:10: error: 'class Dice' has no member named 'routen'
  150 |     dice.routen(str[i]);
      |          ^~~~~~
a.cc:153:16: error: 'class Dice' has no member named 'upnum'
  153 |   cout << dice.upnum() << endl;
      |                ^~~~~