Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

MY OUTPUT:

image text in transcribed

MY CODE:

image text in transcribed

image text in transcribed

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

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

1. Why do most capital budgeting methods focus on cash flows?

Answered: 1 week ago

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago