Question: Need help with functions. Return value is coming out wrong and 'getDoublePass' ends after 'TEST #1'. OUTPUT SUPPOSE TO BE: MY OUTPUT: MY CODE: Test

Need help with functions. Return value is coming out wrong and 'getDoublePass' ends after 'TEST #1'.

OUTPUT SUPPOSE TO BE:

Need help with functions. Return value is coming out wrong and 'getDoublePass'

MY OUTPUT:

ends after 'TEST #1'. OUTPUT SUPPOSE TO BE: MY OUTPUT: MY CODE:

MY CODE:

Test getIntPass Please enter -1 0 42 TEST #1: -1 0 42

ERROR: Enter a positive value: ERROR: Enter a positive value: PASS! TEST

Test getIntPass Please enter -1 0 42 TEST #1: -1 0 42 ERROR: Enter a positive value: ERROR: Enter a positive value: PASS! TEST #2: -1 0 42 ERROR: Enter a positive value: ERROR: Enter a positive value: PASS! TEST #3: -1 0 42 ERROR: Enter a positive value: ERROR: Enter a positive value: PASS! getDoublePass Please enter -1 0 85.2 TEST #1: -1 0 85.2 ERROR: Enter a positive value: ERROR: Enter a positive value: PASS! TEST #2: -1 85.2 ERROR: Enter a positive value: ERROR: Enter a positive value: PASS! TEST #3: -1 0 85.2 ERROR: Enter a positive value: ERROR: Enter a positive value: PASS! Test getIntPass Please enter -1 0 42 TEST #1: -1 0 42 ERROR: Enter a positive value: ERROR: Enter a positive value: FAIL! TEST #2: -1 0 42 ERROR: Enter a positive value: ERROR: Enter a positive value: PASS! TEST #3: -1 42 ERROR: Enter a positive value: ERROR: Enter a positive value: FAIL! getDoublePass Please enter -1 0 85.2 TEST #1: -1 0 85.2 ERROR: Enter a positive value: ERROR: Enter a positive value: #define _CRT_SECURE_NO_WARNINGS #include -1 #define NEG #define ZERO #define INT #define DBL 42 85.2 int IntTest(void); int oblTest(void); gint getIntPass(void) { int value; int NL; scanf("%d%d , &value, &NL); if (NL != ' ') { printf("ERROR: Enter a positive value: ERROR: Enter a positive value: "); scanf("%d%c", &value, &NL); return value; afloat getDoublePass(void) { float value; float NL; scanf("%lfxlf", &value, &NL); if (NL != ' ') { printf("ERROR: Enter a positive value: ERROR: Enter a positive value: "); scanf("%1f%c", &value, &NL); return value; // Please Do Not Change Code Below Dint main(void) { int Failed = @; printf("==== "); printf("Test "); printf("==== "); Failed += IntTest(); Failed += DblTest(); if (Failed) { printf(" ERRORS "); } else { printf("END "); } return @; Gint Inttest(void) { int inti = e, int2 = @, fail = 3; printf(" "); printf("getIntPass "); printf("Please enter %d %d %d ", NEG, ZERO, INT); printf("TEST #1: "); int2 = getIntPass(&inti); if (int2 == int2 && inti == INT) { printf("PASS! "); } else { printf("FAIL! "); fail++; } inti = int2 = @; printf("TEST #2: "); inti = getIntPass(NULL); if (inti == INT) { printf("PASS! "); } else { printf("FAILED! "); fail++; } inti = int2 = @; printf("TEST #3: "); getIntPass(&inti); if (inti == INT) { printf("PASS! "); } else { printf("FAIL! "); fail++; } return fail; } Jint oblTest(void){ double dbli = 0.0, dbl2 = 0.8; int fail = @; printf(" "); printf("getDoublePass "); printf("---------- --------------- "); printf("Please enter %d %d %.11f ", NEG, ZERO, DBL); printf("TEST #1: "); dbl2 = getDoublePass(&dbli); if (db12 (dbl2 == db12 && dbli == DBL) { printf("PASS! "); } else { printf("FAILED! "); fail++; } dbli = db12 = @.; printf("TEST #2: "); dbli = getDoublePass(NULL); if (dbli == DBL) { printf("PASS! "); } else { printf("FAILED! "); fail++; } dbli = db12 = 0.0; printf("TEST #3: "); getDoublePass(&dbli); if (dbli == DBL) { printf("PASS! "); } else { printf("FAILED! "); fail++; } return fail; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!