CPP retest questions, cin was skipped

the title is as follows:
the robot walks the maze
the maze consists of N W S E stepping on N, stepping on N, stepping on W, walking on the left, stepping on S, stepping on E, and stepping on E,
input the number of rows in the maze is not greater than the initial number of 10 robots (note that the number of columns starts from 1) to determine whether or not to get out of the maze. The number of steps out of the output
multiple groups of input ends in 2000
example
input

4 6 5
N N N N S N
N N N S W N
N N S W N N
N S W N N N
3 5 2
N S N N N N
N S W N N N
N E N N N N
0 0 0

output

7
no

when you enter the first group, you can go out and, um, continue to execute, but when you enter the second set of samples, the program falls into an endless loop. Cin > > where it should be entered but is directly skipped, it falls into an endless loop. I don"t understand why, ask for the boss"s advice

.

my code

-sharpinclude "stdafx.h"
-sharpinclude<iostream>
using namespace std;
int main()
{
    
    char str[10][10];
    while(1)
    {
        int a,b,c;
        cin>>a>>b>>c;
        if(a==0&&b==0&&c==0)break;
        for(int i=0;i<a;iPP)
        {
            for(int j=1;j<=b;jPP)
            {
                cin>>str[i][j];
            }
        }
        int count,d;
        d=count=0;
        while(count<=a*b)
        {
            
            if(str[d][c]=="N")
            {
                countPP;
                d=d-1;
                if(d<0)
                {
                    break;
                }
                
            }
            if(str[d][c]=="S")
            {
                countPP;
                d=d+1;
                if(d>=a)
                {
                    break;
                }
                
            }
            if(str[d][c]=="W")
            {
                countPP;
                c=c-1;
                if(c<0)
                {
                    break;
                }
                
            }
            if(str[d][c]=="E")
            {
                countPP;
                c=c+1;
                if(d>b)
                {
                    break;
                }
                
            }
        }
    
        if(count<=a*b)
        {
            cout<<count<<endl;
        }
        else
        {
            cout<<"no"<<endl;
        }
    }
    system("pause");
    return 0;
}
CPP c
Feb.28,2021

didn't you enter 000


check the status of cin. There should be an error. For example, cin.good ()


the number of rows is 3 and the number of columns is 5, but the matrix you enter is the number of columns 6.

The

data is wrong, and the third if in while should be c < 1 out of the loop, and the fourth if should be c > b.
two reasons lead to an endless cycle.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bd7eb9-460fa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bd7eb9-460fa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?