this simple program is to calculate how many banknotes and coins i created BNC function with two parameters the first the reminded money and the second is the paper/coin value and with every calculation there is 0.01 from money is missing idk why
#include <iostream>
using namespace std;
float BNC(float &monex, float value) {
float amount = 0;
while (monex >= value){
monex -= value;
amount += 1;
}
return amount;
}
int main()
{
float x;
cin >> x;
cout << "NOTAS:" << endl;
cout << BNC(x, 100) << " nota(s) de R$ 100.00" << endl;
cout << BNC(x, 50) << " nota(s) de R$ 50.00" << endl;
cout << x << endl;
cout << BNC(x, 20) << " nota(s) de R$ 20.00" << endl;
cout << BNC(x, 10) << " nota(s) de R$ 10.00" << endl;
cout << BNC(x, 5) << " nota(s) de R$ 5.00" << endl;
cout << BNC(x, 2) << " nota(s) de R$ 2.00" << endl;
cout << "MOEDAS:" << endl;
cout << BNC(x, 1) << " moeda(s) de R$ 1.00" << endl;
cout << BNC(x, 0.50) << " moeda(s) de R$ 0.50" << endl;
cout << BNC(x, 0.25) << " moeda(s) de R$ 0.25" << endl;
cout << BNC(x, 0.10) << " moeda(s) de R$ 0.10" << endl;
cout << BNC(x, 0.05) << " moeda(s) de R$ 0.05" << endl;
cout << BNC(x, 0.01) << " moeda(s) de R$ 0.01" << endl;
}