my wrong "halloween candy" solution
Can someone tell me how do You understand this puzzle, and what is wrong in my code. I wasn't able to understand the given problem in this puzzle. I managed to clear it by messing around with values and Switch. #include <iostream> #include <cmath> using namespace std; int main() { int house; cin>>house; float houses; houses=house; int a,b,c; //your code goes here int bills=2; int tooth=1; float candy; /* if (houses>3){ candy=houses-3; } else{ candy=0; } */ switch (house) { case 51 ... 500: candy=4; cout<<candy; break; case 2 ... 50: candy=2/houses*100; candy=round(candy); cout<<candy<<endl; break; /* case 2: candy=50; cout<<candy; break; case 1: candy=0; cout<<candy; break; */ default: candy=1; cout<<candy; break; } //4=1candy,2bills,1tooth //5=2candy,2bills,1tooth return 0; }