#include
#include<stdlib.h>
#include<math.h>
#include
#include<string.h>
#include
#include <bits/stdc++.h>
using namespace std;
bool compare(int a,int b)
{
return a<=b;
}
int main()
{
int coins[]={1,2,5,10,20,50,100,200,500,2000};
int n=sizeof(coins)/sizeof(int);
int money=120;
int lb=lower_bound(coins,coins+n,money,compare)-coins; /* if we donot subtract 1 , we get result 7 value 200. What is the use of compare function and how is it actually
working . How do we come to know how to define the custom comaprator function. In this case we wanted to overwrite what lower_bound function was doing but we still got ans 7 value 200 */
cout<<lb<<"val"<<coins[lb];
return 0;
}