In this wine problem,i tried to display the sequence of prices through which maximum price of selling can be found out.But unable to display it.What is wrong with the code.
Unable to display the list
you have to put braces in base case
it will return always hence not printing the ans
void listall(int arr[],int i,int j,int y)
{
if(i==j)
cout<<arr[i]<<endl;
return;
if((arr[i]*y+winemaxprice(arr,i+1,j,y+1))>((arr[i]*y+winemaxprice(arr,i+1,j,y+1))))
{
cout<<arr[i]<<endl;
listall(arr,i+1,j,y+1);
}
else
{
cout<<arr[j]<<endl;
listall(arr,i,j-1,y+1);
}
}