Browse Source

refactoring: change variable names and attach descriptive comments in calculatorGetUserInputFactorial.c

remotes/origin/feature/calculator-get-user-input-factorial
fdai7514 2 years ago
parent
commit
b796599129
  1. 14
      src/calculatorGetUserInputFactorial.c
  2. 4
      src/calculatorGetUserInputFactorial.h

14
src/calculatorGetUserInputFactorial.c

@ -1,16 +1,20 @@
#include "calculatorGetUserInputFactorial.h" #include "calculatorGetUserInputFactorial.h"
int allowWhen()
// Note:
/* This Function may or may not be implemented in actual program, even if it is merged to the main branch.
If it is temporarily not included in the main Program, then this has a role in future Development of the Project */
int allowWhen()// int allowWhen() is helpful for indirectly unittesting void calculatorGetUserInputFactorial()
{ {
if(q == 1)
if(utc == 1)
return 1; return 1;
} }
void calculatorGetUserInputFactorial(int *z)
void calculatorGetUserInputFactorial(int *num)
{ {
if(allowWhen() == 1)
if(allowWhen() == 1)//Only when int allowWhen() returns 1, void calculatorGetUserInputFactorial() will display desired Output
{ {
printf("num: "); printf("num: ");
scanf("%d", z);
scanf("%d", num);
} }
} }

4
src/calculatorGetUserInputFactorial.h

@ -3,8 +3,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
int allowWhen(); int allowWhen();
const int q = 1;
void calculatorGetUserInputFactorial(int *z);
const int utc = 1; //ufc is unitTestConstant, which has a role in unittesting void calculatorGetUserInputFactorial()
void calculatorGetUserInputFactorial(int *num);
#endif // CALCULATORGETUSERINPUTFACTORIAL_H #endif // CALCULATORGETUSERINPUTFACTORIAL_H
Loading…
Cancel
Save