What is wrong in the code- "PIYUSH AND MAGICAL PARK"

#include
using namespace std;

int magicalParks(char a[][100],int n,int m,int k,int s){

bool success=true;

for(int i=0;i<n;i++)
{

    if(s<k)
	 {   
	    
		 success=false;
		 
		// return false;
		 break;
	 }

 for(int j=0;j<m;j++)
   {
	  char ch=a[i][j];
	 /* if(s<k)
	 {
		 success=false;
		 break;
	 }*/
	 

	 if(ch=='.')
	{
		s = s-2;
	}

	else if(ch=='*' )
	{
		s = s+5;
	}
	
	else {
		break;
	   }
	   
	   if(j!=n-1){
	   	
	   	  s=s-1;
	   }

    

	 

      }


  }

  return s;

}

int main(){

int row,col,k,s;

cin>>row>>col>>k>>s;

char park [100][100];

for(int i=0;i<row;i++){

	for(int j=0;j<col;j++){

		cin>>park[i][j];
	}
}

int check = magicalParks(park,row,col,k,s);

 if(check){

   cout<<"YES"<<endl;
   cout<<check<<endl;

}
else{

   cout<<"NO";
     }


return 0;

}

Hi @manish99
refer this https://ide.codingblocks.com/s/626255

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.