#include #include int trucks = 40; int numWheels = 10; int weeks = 20; int k1 = 5; int k2 = 10; int k3 = 25; int k4 = 30; int k5 = 30; int round(double num) { int result = num; if (num - result >= 0.5) result++; return result; } void inputData() { cout << "Number of trucks:"; cin >> trucks; cout << "Number of truck's wheels:"; cin >> numWheels; cout << "Number of weeks:"; cin >> weeks; cout << "Damaging wheels 6000 km:"; cin >> k1; cout << "Damaging wheels 12000 km:"; cin >> k2; cout << "Damaging wheels 18000 km:"; cin >> k3; cout << "Damaging wheels 24000 km:"; cin >> k4; cout << "Damaging wheels 30000 km:"; cin >> k5; } void main() { clrscr(); inputData(); int q100 = trucks * numWheels; int q80 = 0; int q60 = 0; int q40 = 0; int q20 = 0; int sum = k1 + k2 + k3 + k4 + k5; double d1 = 1 - (double)k1 / sum; //sum -= k1; double d2 = 1 - (double)k2 / sum; //sum -= k2; double d3 = 1 - (double)k3 / sum; //sum -= k3; double d4 = 1 - (double)k4 / sum; for (int week = 1; week <= weeks; week++) { if (week % 3 == 0) { q20 = round(q40 * d4); q40 = round(q60 * d3); q60 = round(q80 * d2); q80 = round(q100 * d1); q100 = trucks*numWheels - q80 - q60 - q40 - q20; cout << "decada N" << week/3 << ": " << q100 << " - new wheels" << endl; if (getch() == 27) break; } } }