Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cout << "\nEnter the task you'd like to perform (0 to terminate): ";
- cin >> taskNumber;
- unsigned n;
- int ** arr = nullptr;
- char * arr1 = nullptr;
- char * arr2 = nullptr;
- int count = 0;
- int count2 = 0;
- while (taskNumber != 0)
- {
- if (taskNumber == 1)
- {
- arr = new int*[2];
- cout << "Enter the columns of your array: ";
- cin >> n;
- for (size_t i = 0; i < 2; i++)
- {
- arr[i] = new int[n];
- }
- cout << "Your array is defined, perform another task: ";
- cin >> taskNumber;
- }
- if (taskNumber == 2)
- {
- cout << "Fill your array: \n";
- fillArray(arr, n);
- cout << "Your array is filled, perform another task: ";
- cin >> taskNumber;
- }
- if (taskNumber == 3)
- {
- if (isInection(arr,n) == true)
- {
- cout << "Your array is an inection! Perform another task: ";
- cin >> taskNumber;
- }
- else
- {
- cout << "Your array is not an inection! Perform another task: ";
- cin >> taskNumber;
- }
- }
- if (taskNumber == 4)
- {
- if (isSurjection(arr,n) == true)
- {
- cout << "Your array is a surjection! Perform another task: ";
- cin >> taskNumber;
- }
- else
- {
- cout << "Your array is not a surjection! Perform another task: ";
- cin >> taskNumber;
- }
- }
- if (taskNumber == 5)
- {
- if (isPermutation(arr,n) == true)
- {
- cout << "There is a permutation! Perform another task: ";
- cin >> taskNumber;
- }
- else
- {
- cout << "There is no permutation! Perform another task: ";
- cin >> taskNumber;
- }
- }
- if (taskNumber == 6)
- {
- cout << "The number of permutations from your input is: " << numberOfPermutations(n) << ". Perform another task: ";
- cin >> taskNumber;
- }
- if (taskNumber == 7)
- {
- if (fixedPoints(arr, n) == true)
- {
- cout << "There is a fixed point! Perform another task: ";
- cin >> taskNumber;
- }
- else
- {
- cout << "There isn't a fixed point! Perform another task: ";
- cin >> taskNumber;
- }
- }
- if (taskNumber == 8)
- {
- cout << "The number of fixed points in your permutation is: " << numberOfFixedPoints(arr, n) << ". Perform another task: ";
- cin >> taskNumber;
- }
- if (taskNumber == 9)
- {
- if (isIdentity(arr, n) == true)
- {
- cout << "Your permutation is identity! Perform another task: ";
- cin >> taskNumber;
- }
- else
- {
- cout << "Your permutation is not an identity! Perform another task: ";
- cin >> taskNumber;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement