idk i think i fixed it i cant remember
This commit is contained in:
parent
ed18a3201a
commit
fcdab38217
2 changed files with 4 additions and 8 deletions
BIN
a.out
BIN
a.out
Binary file not shown.
12
quadratic.c
12
quadratic.c
|
@ -1,16 +1,12 @@
|
||||||
#include <stdio.h> //printf and shit
|
#include <stdio.h> //printf and shit
|
||||||
#include <math.h> //website told me to use fabs for floating point absolute value
|
#include <math.h> //website told me to use fabs for floating point absolute value. this also has sqrt (sqrt for somereason needs the -lm compile flag)
|
||||||
|
#include <stdlib.h> //this has atoi which i forgot to incled but it still combiled idk dont @ me
|
||||||
|
|
||||||
int main( int argc, char *argv[] ) { //yoinked from the internet argc is number of args and argv is a "array of arguments"
|
int main( int argc, char *argv[] ) { //yoinked from the internet argc is number of args and argv is a "array of arguments"
|
||||||
|
|
||||||
int a, b, c; //uhhhhhh how to ascii to float
|
int a, b, c; //uhhhhhh how to ascii to float
|
||||||
|
|
||||||
float x, deter, plusans, minusans;
|
float deter, plusans, minusans;
|
||||||
|
|
||||||
|
|
||||||
const float pi = 3.1415926535897932384626338f;
|
|
||||||
|
|
||||||
printf("%f\n", pi); //did i print pi corectly???
|
|
||||||
|
|
||||||
if (argc != 4) {
|
if (argc != 4) {
|
||||||
puts("please provide a b c");
|
puts("please provide a b c");
|
||||||
|
@ -23,7 +19,7 @@ int main( int argc, char *argv[] ) { //yoinked from the internet argc is number
|
||||||
|
|
||||||
printf("Got: %dx²+%dx+%d\n", a, b, c); //wow this looks like ass
|
printf("Got: %dx²+%dx+%d\n", a, b, c); //wow this looks like ass
|
||||||
|
|
||||||
deter = (b^2)-(4*a*c);
|
deter = (b*b)-(4*a*c);
|
||||||
//deter = 12f;
|
//deter = 12f;
|
||||||
printf("Deter = %f\n", deter);
|
printf("Deter = %f\n", deter);
|
||||||
if (deter < 0) {
|
if (deter < 0) {
|
||||||
|
|
Loading…
Reference in a new issue