Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
array-in-a-matrix | 86979c9d54 | |
array-in-a-matrix | 5583e2ddb8 | |
array-in-a-matrix | 870de20e20 | |
array-in-a-matrix | 3d6877c822 | |
array-in-a-matrix | 97dbc9fb7b | |
array-in-a-matrix | 16e566bfa0 | |
array-in-a-matrix | 5fa84b93fb | |
array-in-a-matrix | 858990447e | |
array-in-a-matrix | 3bb69b067b | |
array-in-a-matrix | 56fa33af33 | |
array-in-a-matrix | 8180560937 |
|
@ -53,3 +53,4 @@ dkms.conf
|
|||
|
||||
# quadratic executable
|
||||
quadratic
|
||||
quadratic-tui
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# quadratic
|
||||
|
||||
Simple cli calculator that computes real and complex roots of a quadratic.
|
||||
<br>
|
||||
Make a project do one thing good rather than do alot that isn't. I learned from my past projects and the best way to code is to KISS.
|
||||
|
|
10
makefile
10
makefile
|
@ -1,2 +1,12 @@
|
|||
DESTDIR ?= /usr/bin
|
||||
|
||||
all:
|
||||
gcc quadratic.c -lm -Wall -O3 -o "quadratic"
|
||||
cp quadratic-tui.sh quadratic-tui
|
||||
|
||||
install:
|
||||
install -Dm755 quadratic $(DESTDIR)/
|
||||
install -Dm755 quadratic-tui $(DESTDIR)/
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)/{quadratic,quadratic-tui}
|
||||
|
|
|
@ -4,7 +4,7 @@ ARG_A=$(whiptail --inputbox "Please enter the value for \"a\":" 10 50 --title "Q
|
|||
|
||||
exitstatus=$?
|
||||
if [ $exitstatus != 0 ]; then
|
||||
echo "User canceled input."
|
||||
echo "User cancelled input."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -12,7 +12,7 @@ ARG_B=$(whiptail --inputbox "Please enter the value for \"b\":" 10 50 --title "Q
|
|||
|
||||
exitstatus=$?
|
||||
if [ $exitstatus != 0 ]; then
|
||||
echo "User canceled input."
|
||||
echo "User cancelled input."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -20,7 +20,7 @@ ARG_C=$(whiptail --inputbox "Please enter the value for \"c\":" 10 50 --title "Q
|
|||
|
||||
exitstatus=$?
|
||||
if [ $exitstatus != 0 ]; then
|
||||
echo "User canceled input."
|
||||
echo "User cancelled input."
|
||||
exit
|
||||
fi
|
||||
|
|
@ -9,7 +9,7 @@ int main(int num_arg, char **args)
|
|||
|
||||
if (num_arg <= 1)
|
||||
{
|
||||
system("/bin/sh /home/linux/Documents/Projects/quadratic/quadratic-tui"); //! need a better solution
|
||||
system("quadratic-tui"); // make sure it is in PATH along with "quadratic" bin
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ int main(int num_arg, char **args)
|
|||
double real_part = (-num_B) / (2 * num_A);
|
||||
double imaginary_part = sqrt(radical * -1.0) / (2 * num_A);
|
||||
|
||||
printf("%f+%fi %f-%fi\n", real_part, imaginary_part, real_part, imaginary_part);
|
||||
printf("%g+%gi\t %g-%gi\n", real_part, imaginary_part, real_part, imaginary_part);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ int main(int num_arg, char **args)
|
|||
double zero_1_ptr = numerator_1 / (2 * num_A);
|
||||
double zero_2_ptr = numerator_2 / (2 * num_A);
|
||||
|
||||
printf("%f %f\n", zero_1_ptr, zero_2_ptr);
|
||||
printf("%g\t %g\n", zero_1_ptr, zero_2_ptr);
|
||||
};
|
||||
};
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue