The bakery is printing today's order slip. breads and counts go together: bread i has counts[i] ordered. In the loop, skip any with 0; for the others show one line such as croissant x3 and add the count to total. The last line is already written.
croissant x3 baguette x2 muffin x5 total: 10
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<string> breads = {"croissant", "bagel", "baguette", "muffin"};
vector<int> counts = {3, 0, 2, 5};
int total = 0;
for (int i = 0; i < (int)breads.size(); i++) {
// your code here: skip a 0; otherwise show a line and add to total
}
cout << "total: " << total << endl;
return 0;
}
Run tries the examples. When they look right, Submit.