Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Functions Given a function f from {1, 2, 3, 4, 5} to itself, write a C++ program to determine whether f is a valid

# Functions

Given a function f from {1, 2, 3, 4, 5} to itself, write a C++ program to determine whether f is a valid function, one-to-one, onto, and/or a bijection.

Input should be entered through console prompts.

Functions can be described as a set of ordered pairs. The program will be tested with the following functions:

Test Input #1: f(1) = 4 f(2) = 5 f(3) = 1 f(5) = 2

Test Input #2: f(1) = 5 f(6) = 4

Test Input #3: f(1) = 2 f(2) = 4 f(3) = 3 f(4) = 2 f(5) = 1

Test Input #4: f(1) = 0 f(5) = 4

Test Input #5: f(1) = 5 f(2) = 4 f(3) = 3 f(4) = 2 f(5) = 1

Test Input #6: f(1) = 5 f(2) = 4 f(3) = 3 f(2) = 2

Output results should be clearly displayed with appropriate labeling. An example of such an output format is given here:

Example 1: Function described by: f(-3) = 5 f(6) = 4
This function is not a valid function.

Example 2:

Function described by: f(1) = 1 f(2) = 4 f(3) = 3 f(4) = 1 f(5) = 1 This function is a valid function. This function is not a one-to-one function. This function is not onto. This function is not a bijection.

Example 3:

image text in transcribed

Example 4:

image text in transcribed

Example 5:

image text in transcribed

Please enter the number of paired values as an integer value: 4 Please enter the function value as an ordered pair f(x) = y as: Please enter the function value as an ordered pair f(x) = y as: x y > 1 4 x y > 25 Please enter the function value as an ordered pair f(x) = y as: x y > 31 Please enter the function value as an ordered pair f(x) = y as: x y > 5 2 This function is a valid function. This function is a one-to-one function. This function is not onto. This function is a bijection. Please enter the number of paired values as an integer value: 5 Please enter the function value as an ordered pair f(x) = y as: xy > 1 2 Please enter the function value as an ordered pair f(x) - y as: x y > 2.4 Please enter the function value as an ordered pair f(x) = y as: x y > 33, Please enter the function value as an ordered pair f(x) - y as: x y > 42, Please enter the function value as an ordered pair f(x) = y as: x y > 5 1 This function is a valid function. This function is not a one-to-one function. This function is not onto. This function is not a bijection. Please enter the number of paired values as an integer value: 4 Please enter the function value as an ordered pair f(x) = y as: x y > 15 Please enter the function value as an ordered pair f(x) = y as: x y > 2 4 Please enter the function value as an ordered pair f(x) = y as: * y> 3 3 Please enter the function value as an ordered pair f(x) = y as: xy > 2 2 Repeated domain value. This is not a valid function. Please enter the number of paired values as an integer value: 4 Please enter the function value as an ordered pair f(x) = y as: Please enter the function value as an ordered pair f(x) = y as: x y > 1 4 x y > 25 Please enter the function value as an ordered pair f(x) = y as: x y > 31 Please enter the function value as an ordered pair f(x) = y as: x y > 5 2 This function is a valid function. This function is a one-to-one function. This function is not onto. This function is a bijection. Please enter the number of paired values as an integer value: 5 Please enter the function value as an ordered pair f(x) = y as: xy > 1 2 Please enter the function value as an ordered pair f(x) - y as: x y > 2.4 Please enter the function value as an ordered pair f(x) = y as: x y > 33, Please enter the function value as an ordered pair f(x) - y as: x y > 42, Please enter the function value as an ordered pair f(x) = y as: x y > 5 1 This function is a valid function. This function is not a one-to-one function. This function is not onto. This function is not a bijection. Please enter the number of paired values as an integer value: 4 Please enter the function value as an ordered pair f(x) = y as: x y > 15 Please enter the function value as an ordered pair f(x) = y as: x y > 2 4 Please enter the function value as an ordered pair f(x) = y as: * y> 3 3 Please enter the function value as an ordered pair f(x) = y as: xy > 2 2 Repeated domain value. This is not a valid function

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

How does planning facilitate the acquisition process?

Answered: 1 week ago

Question

outline some of the current issues facing HR managers

Answered: 1 week ago