Last active
September 21, 2015 19:06
-
-
Save alexhsamuel/1253062f1f8edc6d5e80 to your computer and use it in GitHub Desktop.
template: find the customer who bought most of each product
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Customer { | |
long id; | |
string const name; | |
// ... | |
}; | |
struct Order { | |
long customer_id; | |
long product_id; | |
int quantity; | |
// ... | |
}; | |
/* | |
* For each product ID that was purchased at least once, prints the product | |
* ID and the name of the customer who ordered the largest total quantity. | |
*/ | |
void bought_most(vector<Customer> const& customers, vector<Order> const& orders) { | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment