Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.44 KB | None | 0 0
  1.     cout << "\nEnter the task you'd like to perform (0 to terminate): ";
  2.     cin >> taskNumber;
  3.  
  4.     unsigned n;
  5.     int ** arr = nullptr;
  6.     char * arr1 = nullptr;
  7.     char * arr2 = nullptr;
  8.     int count = 0;
  9.     int count2 = 0;
  10.     while (taskNumber != 0)
  11.     {
  12.         if (taskNumber == 1)
  13.         {
  14.             arr = new int*[2];
  15.             cout << "Enter the columns of your array: ";
  16.             cin >> n;
  17.  
  18.             for (size_t i = 0; i < 2; i++)
  19.             {
  20.                 arr[i] = new int[n];
  21.             }
  22.             cout << "Your array is defined, perform another task: ";
  23.             cin >> taskNumber;
  24.         }
  25.         if (taskNumber == 2)
  26.         {
  27.             cout << "Fill your array: \n";
  28.             fillArray(arr, n);
  29.             cout << "Your array is filled, perform another task: ";
  30.             cin >> taskNumber;
  31.         }
  32.         if (taskNumber == 3)
  33.         {
  34.             if (isInection(arr,n) == true)
  35.             {
  36.                 cout << "Your array is an inection! Perform another task: ";
  37.                 cin >> taskNumber;
  38.  
  39.             }
  40.             else
  41.             {
  42.                 cout << "Your array is not an inection! Perform another task: ";
  43.                 cin >> taskNumber;
  44.             }
  45.         }
  46.         if (taskNumber == 4)
  47.         {
  48.             if (isSurjection(arr,n) == true)
  49.             {
  50.                 cout << "Your array is a surjection! Perform another task: ";
  51.                 cin >> taskNumber;
  52.             }
  53.             else
  54.             {
  55.                 cout << "Your array is not a surjection! Perform another task: ";
  56.                 cin >> taskNumber;
  57.             }
  58.         }
  59.         if (taskNumber == 5)
  60.         {
  61.             if (isPermutation(arr,n) == true)
  62.             {
  63.                 cout << "There is a permutation! Perform another task: ";
  64.                 cin >> taskNumber;
  65.             }
  66.             else
  67.             {
  68.                 cout << "There is no permutation! Perform another task: ";
  69.                 cin >> taskNumber;
  70.             }
  71.         }
  72.         if (taskNumber == 6)
  73.         {
  74.             cout << "The number of permutations from your input is: " << numberOfPermutations(n) << ". Perform another task: ";
  75.             cin >> taskNumber;
  76.         }
  77.         if (taskNumber == 7)
  78.         {
  79.             if (fixedPoints(arr, n) == true)
  80.             {
  81.                 cout << "There is a fixed point! Perform another task: ";
  82.                 cin >> taskNumber;
  83.             }
  84.             else
  85.             {
  86.                 cout << "There isn't a fixed point! Perform another task: ";
  87.                 cin >> taskNumber;
  88.             }
  89.         }
  90.         if (taskNumber == 8)
  91.         {
  92.             cout << "The number of fixed points in your permutation is: " << numberOfFixedPoints(arr, n) << ". Perform another task: ";
  93.             cin >> taskNumber;
  94.         }
  95.         if (taskNumber == 9)
  96.         {
  97.             if (isIdentity(arr, n) == true)
  98.             {
  99.                 cout << "Your permutation is identity! Perform another task: ";
  100.                 cin >> taskNumber;
  101.             }
  102.             else
  103.             {
  104.                 cout << "Your permutation is not an identity! Perform another task: ";
  105.                 cin >> taskNumber;
  106.             }
  107.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement