Browse Source

implemented printlf

remotes/origin/userinput
TheUltimateOptimist 11 months ago
parent
commit
a3869ae3a4
  1. 2
      project.yml
  2. 10
      src/userinput.c

2
project.yml

@ -88,7 +88,7 @@
:placement: :end :placement: :end
:flag: "-l${1}" :flag: "-l${1}"
:path_flag: "-L ${1}" :path_flag: "-L ${1}"
:system: [] # for example, you might list 'm' to grab the math library
:system: [m] # for example, you might list 'm' to grab the math library
:test: [] :test: []
:release: [] :release: []

10
src/userinput.c

@ -4,6 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h>
void trimLeft(char *input) { void trimLeft(char *input) {
size_t length = strlen(input); size_t length = strlen(input);
@ -69,4 +70,13 @@ char *getstr(char *message, unsigned long *minLength, unsigned long *maxLength)
result = readInput(); result = readInput();
} }
return result; return result;
}
void printlf(long double value) {
if (roundl(value) == value) {
printf("%.0Lf", value);
}
else {
printf("%Lf", value);
}
} }
Loading…
Cancel
Save