#include using namespace std; int Pouring(float jug, float *bottle, int m) { int i = 0; int count = 0; while (jug > 0 && i < m) { if (jug >= bottle[i]) { jug -= bottle[i]; count++; } i++; } return count; } int main() { int m = 5; float jug = 10; float bottle[] = {2, 3, 4, 5, 8}; cout << "m = " << m << endl; cout << "jug = " << jug << endl; cout << "Ket qua: " << Pouring(jug, bottle, m); return 0; }