HElP Discrete Math for CS C Sets and Relations I have few q
HElP!!!! Discrete Math for CS C++ - Sets and Relations
I have few questions that i do not know how to answer it, can you give a short answer. (Please do not copy and paste on the internet)
Sets Use-
1)What is the purpose of learning the set rules/laws?
2)What do they represent to you?
Sets and classes -
3) How are sets, OOP classes and concepts related?
4) What are all the rules for sets? Create a list, with the symbols, alternative symbols, definition and example and Venn Diagram Illustrating each.
Solution
using std::cout;
 using std::cin;
 void ASearch(int arr[], int);
 void BSearch(int array[], int size);
 void CSearch(int array[], int size);
 int main(int argc, const char * argv[])
 {
 const int SIZE = 10;
 int NumArray[10];
 int num = 0;
 int count = 0;
 while (count < 10)
 {
 cout << \"Enter Number \"<< count + 1 <<\": \";
 cin >> NumArray[count];
 ++count;
 }
 {
 for (int i = 0; i < 9; ++i)
 {
 cout << \"Enter Number \"<< i + 2 <<\": \";
 cin >> NumArray[i];
 }
 }else cout << \"Error: numbers only\";*/
 for(int j = 0; j < SIZE; ++j)
 {
 cout << \" \" << NumArray[j];
 }
 ASearch(NumArray, SIZE);
 BSearch(NumArray, SIZE);
 CSearch(NumArray, SIZE);
 return 0;
 }
 void ASearch(int arr[], int size)
 {
 int pos = 0;
 int on = -1;
 int oddTrue = 0;
 int oddFalse = 0;
 while (on == -1 && pos < size)
 {
 cout << \" \ checking: \" << arr[pos];
 if (arr[pos] % 2 != 0 && arr[pos] > 0)
 {
 cout <<\"\ True: \" <<arr[pos] << \" is > 0 and odd\";
 ++oddTrue;
 }
 else if(arr[pos] % 2 != 0 && arr[pos] < 0)
 {
 cout <<\"\ False\" << arr[pos] << \"is < 0 and odd\";
 ++oddFalse;
 }
 else cout << \"\ Number is even\";
 ++pos;
 }
 if (oddFalse > 0) cout<< \"\ >>>>>>>>>A is FALSE\";else cout <<\"\ >>>>>>A IS TRUE\";
 return;
 }
 void BSearch(int array[], int size)
 {
 int on = -1;
 int pos = 0;
 int count = 0;
 while(on == -1 && pos < size)
 {
 cout << \"\  checking \"<<array[pos];
 if(array[pos] % 2 != 0 && array[pos] > 10)
 {
 cout << \"\ True: \" << array[pos] <<\" is > 10 & odd\";
 ++count;
 }else
 {
 cout <<\"\ False\";
 --count;
 }
 ++pos;
 }
 if(count > 1 ) cout << \"\ >>>>>>>>>>B IS TRUE\"; else cout <<\"\ >>>>>>>>>B IS FALSE\";
 return;
 }
 void CSearch(int array[], int size)
 {
 int pos = 0;
 int on = -1;
 int TrueCount = 0;
 int FalseCount = 0;
 while (on == -1 && pos < size)
 {
 cout << \"\  checking \"<<array[pos];
 if(array[pos] % 2 == 0 || array[pos] % 3 == 0)
 {
 cout << \"\ True: \" << array[pos] <<\" is divisible by 2 or 3\";
 ++TrueCount;
 }
 else if(array[pos] % 2 != 0 || array[pos] % 3 != 0)
 {
 cout <<\"\ False\";
 ++FalseCount;
 }
 ++pos;
 }
 if (TrueCount < 10)
 cout << \"\ >>>>C is FALSE\"; else cout << \"\ >>>>>>>>>>C is TRUE\";
 }



