// This program uses two arrays to record the names of 6 types of pizza // and t
ID: 3770962 • Letter: #
Question
// This program uses two arrays to record the names of 6 types of pizza // and the sales numbers for each of these types // The program then finds the best and the worst selling pizzas #include #include using namespace std; int main() { const int ARR_SIZE=6; int name[ARR_SIZE]=["Pepperoni","Prociutta","Vegetarian", "Sausage","Supreme","Mozarella"]; int sales[ARR_SIZE]; int worstseller_number, bestseller_number; string worstseller_name, bestseller_name; for(int i=1; i> sales[i]; } worstseller_name = bestseller_name = name[0]; worstseller_number = bestseller_number = sales[0]; for(int i=0; i<=ARR_SIZE; i++) { if(sales[i]
Explanation / Answer
Program Cont.......
if(sales[i]<worstseller_number)
{
worstseller_number=sales[i];
worstseller_name=name[i];
}
if(sales[i]>bestseller_number)
{
bestseller_number=sales[i];
bestseller_name=name[i];
}
}
cout << "The bestselling pizza is " << bestseller_name << " with the sales of "<< bestseller_number << endl;
cout << "The worst selling pizza is " << worstseller_name << " with the sales of "<< worstseller_number << endl;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.