Campbell Ritchie wrote:I can think of any easy way to do it, too
The way Kalabaw Moo does itseetharaman venkatasamy wrote:what is the way?
If user chooses [1], the program prompts for the elements of the sets:
How many elements for set A? 3
Element 1: A
Element 2: B
Element 3: C
How many elements for set B? 2
Element 1: 1
Element 2: 2
The sets are:
A= {A,B,C}
B={1,2}
If user chooses[2], the program displays the sets. If a set has not been defined yet, the program should display the message “Sets are still undefined”.
If user chooses[3], the program displays the Cartesian Product of set A and B. If a set has not been defined yet, the program should display the message “Sets are still undefined”.
If user chooses[4], the program asks the user to inputs a set and the program determines if it is a function. If a set has not been defined yet, the program should display the message “Sets are still undefined”.
If user chooses[5], the program asks the user to inputs a set and the program determines if it is a relation. If a set has not been defined yet, the program should display the message “Sets are still undefined”.
How many elements for Set A? 3
Enter element for Set A: A
Enter element for Set A: B
Enter element for Set A: C
How many elements for Set B? 2
Enter element for Set B: 1
Enter element for Set B: 2
Sets are now defined.
The cartesian product is: AXB = { A, 1}, { A, 2 }, { B, 1 }, { B, 2 }, { C, 1 }, { C, 2 }
==========================================================
I still think you can never get a function out of a Cartesian product. But I made a dreadful mistake which nobody has noticed. I wrote "domain" when I ought to have written "range".By the way, the Cartesian product of two sets where the domain Set has more than one member can never be a function.
If user chooses[4], the program asks the user to inputs a set and the program determines if it is a function. If a set has not been defined yet, the program should display the message “Sets are still undefined”.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |