Page 3 of 3

Re: 10949 - Kids in a Grid

Posted: Tue Aug 05, 2014 12:39 am
by brianfry713

Code: Select all

      int i =1;
      while(c!='\n'){

         if (c == 'N')
            x -= 1;
         else if (c == 'S')
            x += 1;
         else if (c == 'W')
            y -= 1;
         else
            y += 1;
         s1[i] = grid[x][y];
         c = getchar();
      }
You aren't incrementing i here.