b.
Code
for ( int i = 0; i < 6; i++ ) {
totalCash += cashDonations[i];
totalFood += foodDonations[i];
}
e.
Code
int maxCash = cashDonatios[0]; //This part is c
int maxFood = foodDonations[0]; //This part is d
for ( int i = 0; i < 6; i++ ) {
if ( foodDonations[i] > maxFood ) {
maxFood = foodDonations[i];
}
if ( cashDonations[i] > maxCash ) {
maxCash = cashDonations[i];
}
}
What is bestSiteCash and bestSiteFood?
I also fixed c and d, and added comments for them
This post was edited by labatymo on Apr 26 2013 02:34pm