Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Phung, Brian
- October 30, 2019
- CS A250
- Lab 9
- */
- #include <algorithm>
- #ifndef FUNCTIONS_H
- #define FUNCTIONS_H
- // Definition of function difference
- int difference(const set<int> x)
- {
- return *x.rbegin() - *x.begin();
- }
- // Definition of function multiplesOfTen
- void multiplesOfTen(map<int, int> &map)
- {
- int multiple = 0; //declare a default value
- for (auto& pair : map)
- {
- if ((pair.first % 10) == 0)
- multiple = pair.first / 10;
- else
- pair.second = multiple * 10;
- }
- }
- // Definition of function afterFive
- void afterFive(const multiset<int> &filled, multiset<int> &empty)
- {
- auto pair = filled.equal_range(5); //pair of iterators
- while (pair.second != filled.end())
- {
- empty.insert(*(pair.second));
- pair.second++;
- }
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement