Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a template function intersect_or_union_fcn that gets vector v1 , v2 , and v3 and determines if the vector v3 is the intersection or union

Write a template function intersect_or_union_fcn that gets vector v1, v2, and v3 and determines if the vector v3 is the intersection or union of vectors v1 and v2.

Example 1: If v1 = {2, 3, 1, 5}, v2 = {3, 4, 5} and v3 = {3, 5}, then:

intersect_or_union_fcn(v1, v2, v3) will print:

v3 is the intersection of v1 and v2

Example 2: If v1 = {2, 3, 1, 5}, v2 = {3, 4, 5} and v3 = {2, 3, 1, 5, 4}, then:

intersect_or_union_fcn(v1, v2, v3) will print:

v3 is the union of v1 and v2

Example 3: If v1 = {2, 3, 1, 5}, v2 = {3, 4, 5} and v3 = {2, 3, 1, 5, 4, 6}, then:

intersect_or_unition_fcn(v1, v2, v3) will print:

v3 is neither the intersection nor the union of v1 and v2.

Write a test program that prompts the user to enter three vectors. Test your program with vectors of type int, double and string.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions