File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
1
/* *
2
2
* @file digit_separation.cpp
3
- * @brief This file contains the DigitSeparation class for separating digits of
4
- * large numbers.
5
- * https://www.log2base2.com/c-examples/loop/split-a-number-into-digits-in-c.html
6
- * @details
3
+ * @brief Separates digits from numbers in forward and reverse order
4
+ * @see https://www.log2base2.com/c-examples/loop/split-a-number-into-digits-in-c.html
5
+ * @details The DigitSeparation class provides two methods to separate the
6
+ * digits of large integers: digitSeparationReverseOrder and
7
+ * digitSeparationForwardOrder. The digitSeparationReverseOrder method extracts
8
+ * digits by repeatedly applying the modulus operation (% 10) to isolate the
9
+ * last digit, then divides the number by 10 to remove it. This process
10
+ * continues until the entire number is broken down into its digits, which are
11
+ * stored in reverse order. If the number is zero, the method directly returns a
12
+ * vector containing {0} to handle this edge case. Negative numbers are handled
13
+ * by taking the absolute value, ensuring consistent behavior regardless of the
14
+ * sign.
7
15
* @author [Muhammad Junaid Khalid](https://github.com/mjk22071998)
8
16
*/
9
17
You can’t perform that action at this time.
0 commit comments