Вопрос скорее будет звучать "как много могли съесть толстяки?".
#include <iostream>
using namespace std;
int main() {
int multiplier = 1;
float weightCake = 0;
float t1(0), t2(0), t3(0);
float t1Cakes(0), t2Cakes(0), t3Cakes(0);
cout << "Weight of cake, fat people 1-3: ";
cin >> weightCake; cin >> t1; cin >> t2; cin >> t3;
while(1) {
t1Cakes = multiplier * weightCake * 1;
if(t1Cakes > t1/2) {
cout << multiplier - 1;
break;
}
t2Cakes = multiplier * weightCake * 2;
if(t2Cakes > t2/2) {
t3Cakes = multiplier * weightCake * 4;
if(t3Cakes > t3/2) {
++multiplier;
Вопрос скорее будет звучать "как много могли съесть толстяки?".
#include <iostream>
using namespace std;
int main() {
int multiplier = 1;
float weightCake = 0;
float t1(0), t2(0), t3(0);
float t1Cakes(0), t2Cakes(0), t3Cakes(0);
cout << "Weight of cake, fat people 1-3: ";
cin >> weightCake; cin >> t1; cin >> t2; cin >> t3;
while(1) {
t1Cakes = multiplier * weightCake * 1;
if(t1Cakes > t1/2) {
cout << multiplier - 1;
break;
}
t2Cakes = multiplier * weightCake * 2;
if(t2Cakes > t2/2) {
cout << multiplier - 1;
break;
}
t3Cakes = multiplier * weightCake * 4;
if(t3Cakes > t3/2) {
cout << multiplier - 1;
break;
}
++multiplier;
}
}