Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Queue>
- Queue get_product(Queue _First, Queue _Second)
- {
- if (_First.size() != _Second.size())
- {
- std::cout << "Size must be equal" << std::endl;
- return nullptr;
- }
- else
- {
- const int result_size = _First.size();
- Queue result;
- for (int i = 0; i < result_size; i++)
- {
- int temp = _First.front() * _Second.front();
- _First.pop();
- _Second.pop();
- Queue.push(temp);
- }
- return result;
- }
- int main() {
- Queue A,B;
- A.push(1);
- A.push(2);
- A.push(3);
- B.push(4);
- B.push(5);
- B.push(6);
- Queue C = get_product(A,B);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement