Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROGRAMMING IN C for some reason my check custom function won't properly calculate how many times my function passes and fails. It only will go

PROGRAMMING IN C for some reason my check custom function won't properly calculate how many times my function passes and fails. It only will go to 1 even though all 4 checks are true. how do I count how many fails and passes I get all together? please help me figure out why my function pointers aren't working properly. below is a screenshot of my code and a screenshot of what I'm getting for my outputs. ( I have created a separate library for all my math)image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

main.c X polynomial.h X polynomial. x 0 0 10 #include #include #include #include "polynomial.h" void check (double fcheck, double pcheck, double acheck, double fprime, double f, double area, int *PASS, int *FAIL); int main() double EPRIME; double F; double AREA; int pass=0; int fail=0; polynomial (2,3,4,5,6, &fPRIME, &F, GAREA); // calling function check (23, 69, 81.167, F, EPRIME, AREA, Spass, fail); printf ("A=2 B=3 C=4 X=5 X2=6 pass=$d fail=%d ", pass, fail); polynomial (2,4,6,8,10, &EPRIME, EF, EAREA); check (166, 36, 80, F, FPRIME, AREA, Spass, &fail); printf ("A-2 B-4 C=6 X=8 X2=10 pass=&d failed ", pass, fail); polynomial (3,6,9,12,7, &EPRIME, &F, GAREA); check (513, 78, -315, F, EPRIME, AREA, (pass, &fail); printf("A=3 B=6 C=9 X=12 X2=7 pass=3d fail=%d ", pass, fail); polynomial (6,5,4,3,2, &EPRIME, &F, &AREA); check (73, 41,-35, F, EPRIME, AREA, Epass, &fail); printf ("A=6 B=5 C=4 X=3 x2=2 pass=kd fail=3d ", pass, fail); printf(" # pass - td # fail - $d ", pass, fail); return 0; 45 void check (double fcheck, double pcheck, double acheck, double fprime, double f, double area, int *PASS, int *FAIL) if((fabs (fcheck-f)<.001 printf polynomial has passed return n void check fcheck double pcheck acheck fprime f area int if un pass failed main.c x polynomial.h polynomial. cx> #include #include "polynomial.h" m in void polynomial (double a, double b, double c, double x, double xi, double *fPrime, double *f, double *area) B { double polynomial; double poly; double poly2; 0 polynomial = (a pow (x, 2)) + (b*x) +c; poly = ((a/3.0) *pow(x,3)) + ((b/2.0) *pow (x, 2)) + (c*x); poly2 = ((a/3.0) *pow(xi,3)) + ((b/2.0) *pow(xi,2)) + (c*xi); oo o o on P 2 N *fPrime = (2*a*x) + b; *area = (poly2-poly); *f = polynomial; N 2 Polynomial has passed A=2 B-3 C=4 X=5 x2=6 pass=1 fail=0 A=2 B=4 C=6 X=8 X2=10 pass=1 fail=0 A=3 B=6 C=9 X=12 X2=7 pass=1 fail=0 A=6 B=5 C=4 X=3 X2=2 pass=1 fail=0 # pass = 1 # fail = 0 execution time: 0.047 s Process returned (@xo_ Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions