Language: C

#include<stdio.h>
#include<string.h>
 
struct dice
{
    int n[6] ; //number
};
struct dice dice1 ;
 
 
int east()
{
    int mem = 0 ;
    mem = dice1.n[0] ;
    dice1.n[0] = dice1.n[3] ;
    dice1.n[3] = dice1.n[5] ;
    dice1.n[5] = dice1.n[2] ;
    dice1.n[2] = mem ;
}
 
int west()
{
    int mem = 0 ;
    mem = dice1.n[0] ;
    dice1.n[0] = dice1.n[2] ;
    dice1.n[2] = dice1.n[5] ;
    dice1.n[5] = dice1.n[3] ;
    dice1.n[3] = mem ;
}
 
int south()
{
    int mem = 0 ;
    mem = dice1.n[0] ;
    dice1.n[0] = dice1.n[4] ;
    dice1.n[4] = dice1.n[5] ;
    dice1.n[5] = dice1.n[1] ;
    dice1.n[1] = mem ;
}
 
int north()
{
    int mem = 0 ;
    mem = dice1.n[0] ;
    dice1.n[0] = dice1.n[1] ;
    dice1.n[1] = dice1.n[5] ;
    dice1.n[5] = dice1.n[4] ;
    dice1.n[4] = mem ;
}
 
int main()
{
    int i=0 ;
    int cmp=0 ;
 
    char a[101] = {0} ;
 
    for (i=0 ;i < 6 ;i++)
    {
        scanf("%d" ,&cmp) ;
 
        dice1.n[i] = cmp ;
 
    }
    scanf("%s" ,a) ;
 
    for (i=0 ;i < 101 ;i++)
    {
        if (a[i] == '\0') break ;
 
        if (strcmp(a[i],E)==0) east() ;
        if (strcmp(a[i],W)==0) west() ;
        if (strcmp(a[i],S)==0) south() ;
        if (strcmp(a[i],N)==0) north() ;
 
    }
 
    printf ("%d\n" ,dice1.n[0]) ;
    return 0 ;
}


Compiler output:
main.c: In function 'main':
main.c:71:25: error: 'E' undeclared (first use in this function)
   71 |         if (strcmp(a[i],E)==0) east() ;
      |                         ^
main.c:71:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:71:21: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   71 |         if (strcmp(a[i],E)==0) east() ;
      |                    ~^~~
      |                     |
      |                     char
In file included from main.c:2:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:72:25: error: 'W' undeclared (first use in this function)
   72 |         if (strcmp(a[i],W)==0) west() ;
      |                         ^
main.c:72:21: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   72 |         if (strcmp(a[i],W)==0) west() ;
      |                    ~^~~
      |                     |
      |                     char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:73:25: error: 'S' undeclared (first use in this function)
   73 |         if (strcmp(a[i],S)==0) south() ;
      |                         ^
main.c:73:21: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   73 |         if (strcmp(a[i],S)==0) south() ;
      |                    ~^~~
      |                     |
      |                     char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:74:25: error: 'N' undeclared (first use in this function)
   74 |         if (strcmp(a[i],N)==0) north() ;
      |                         ^
main.c:74:21: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   74 |         if (strcmp(a[i],N)==0) north() ;
      |                    ~^~~
      |                     |
      |                     char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~