summaryrefslogtreecommitdiffstats
path: root/kbruch/src
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-04-07 18:23:54 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-04-07 23:24:46 +0900
commitfd06779f93512aa68988b165260941e6d3f1ff0f (patch)
treebb06d03e494a97eae182a18562677e2e5b17bed5 /kbruch/src
parentf1a4e21e9735931cfb58943bb1a3da4353e14302 (diff)
downloadtdeedu-r14.1.4.tar.gz
tdeedu-r14.1.4.zip
Replace TRUE/FALSE with boolean values true/falser14.1.4
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 35149ce0bd6a7e9a315a395291ed4b59499b63cf)
Diffstat (limited to 'kbruch/src')
-rw-r--r--kbruch/src/ratio.cpp2
-rw-r--r--kbruch/src/task.cpp26
-rw-r--r--kbruch/src/task.h6
-rw-r--r--kbruch/src/taskwidget.h4
4 files changed, 15 insertions, 23 deletions
diff --git a/kbruch/src/ratio.cpp b/kbruch/src/ratio.cpp
index 0ba1e1c4..48827288 100644
--- a/kbruch/src/ratio.cpp
+++ b/kbruch/src/ratio.cpp
@@ -186,7 +186,7 @@ ratio ratio::operator=(int dummy)
return *this;
}
-/* check, if the ratios are equivalent; -1/2 == 1/-2 -> TRUE */
+/* check, if the ratios are equivalent; -1/2 == 1/-2 -> true */
bool ratio::operator==(ratio right)
{
signed short orig_sign = 1, right_sign = 1;
diff --git a/kbruch/src/task.cpp b/kbruch/src/task.cpp
index 50cd2f28..1ebd13e9 100644
--- a/kbruch/src/task.cpp
+++ b/kbruch/src/task.cpp
@@ -45,18 +45,18 @@ task::~task()
* can be customized by the given parameters:
* pmax_md: maximum main denominator
* pnr_ratios: number of ratios -> pnr_ratios - 1 operations
- * padd_sub: if TRUE + and - are allowed operations
- * pmul_div: if TRUE * and / are allowed operations */
+ * padd_sub: if true + and - are allowed operations
+ * pmul_div: if true * and / are allowed operations */
void task::create_task(unsigned int pmax_md, short pnr_ratios,
- short padd_sub, short pmul_div)
+ bool padd_sub, bool pmul_div)
{
unsigned short max_product_length = 0;
int main_denominator = 1;
/* we say that if add/sub and mul/div are not allowed we want a task
* for add/sub only */
- if (padd_sub == NO && pmul_div == NO)
- padd_sub = YES;
+ if (!padd_sub && !pmul_div)
+ padd_sub = true;
do
{
@@ -395,9 +395,9 @@ unsigned short task::make_operation(short padd_sub, short pmul_div,
ShortArray::iterator op_pointer;
/* we need this to generate the fitting operations */
- if (padd_sub == YES)
+ if (padd_sub)
operations += 2;
- if (pmul_div == YES)
+ if (pmul_div)
operations += 2;
/* clear the old operations */
@@ -409,7 +409,7 @@ unsigned short task::make_operation(short padd_sub, short pmul_div,
/* if we only wanted mul/div, operations was 2; but we want values
* for the operations with 2 and 3 so we have to add 2 */
- if (padd_sub == NO && pmul_div == YES)
+ if (!padd_sub && pmul_div)
{
/* loop through all operations and add 2, so that the operations
* are interpreted as mul/div and not add/sub */
@@ -418,7 +418,7 @@ unsigned short task::make_operation(short padd_sub, short pmul_div,
*op_pointer += 2;
}
- if (pmul_div == YES)
+ if (pmul_div)
{
short flag_counter = 0;
@@ -453,13 +453,13 @@ unsigned short task::make_operation(short padd_sub, short pmul_div,
max_product_length++;
}
else
- { /* if (pmul_div == YES) */
+ { /* if (pmul_div) */
/* a task is given only with add/sub ops; so we want a max.
* of pnr_ratios / 2 + 1 prime factors, but at least */
max_product_length = (unsigned short) (float(pnr_ratios) / 2) + 1;
if (max_product_length < 2)
max_product_length = 2;
- } /* if (pmul_div == YES) */
+ } /* if (pmul_div) */
return max_product_length;
}
@@ -580,7 +580,7 @@ void task::make_denominators(int main_denominator, short pmax_md,
/* if the ratio is connected to a mul or div operation, we have to do some
* extra work and regenerate the denominators */
- if (pmul_div == YES)
+ if (pmul_div)
{
/* lets loop through all ratios and check, if there is a mul/div
* after the ratio */
@@ -697,7 +697,7 @@ void task::make_denominators(int main_denominator, short pmax_md,
}
ratio_pointer++;
}
- } /* if (pmul_div == YES) */
+ } /* if (pmul_div) */
return;
}
diff --git a/kbruch/src/task.h b/kbruch/src/task.h
index 57c80b86..806e11b9 100644
--- a/kbruch/src/task.h
+++ b/kbruch/src/task.h
@@ -23,10 +23,6 @@
#include <vector>
-/** important for add_sub and mul_div */
-#define YES 1
-#define NO 0
-
/** important for op_vector */
#define ADD 0
#define SUB 1
@@ -73,7 +69,7 @@ public:
/** automatically generate a new task with the given parameters */
void create_task(unsigned int pmax_md = 10, short pnr_ratios = 2,
- short padd_sub = YES, short pmul_div = NO);
+ bool padd_sub = true, bool pmul_div = false);
/** set ratio n */
void set_ratio_n(unsigned short number = 0, int numerator = 0,
diff --git a/kbruch/src/taskwidget.h b/kbruch/src/taskwidget.h
index 647da4b2..1644ca87 100644
--- a/kbruch/src/taskwidget.h
+++ b/kbruch/src/taskwidget.h
@@ -27,10 +27,6 @@
#include <tqwidget.h>
-/** important for add_sub and mul_div */
-#define YES 1
-#define NO 0
-
/** important for op_vector */
#define ADD 0
#define SUB 1