gram acts as an auction house. We’ll let the users bet on x number of products. Assume the minimum bid is $100 (their bid must be at least the minimum). */ #include

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 1TF: Mark the following statements as true or false: a. To use a predefined function in a program, you...
icon
Related questions
Question

Please fill in the blanks in C.

/* This program acts as an auction house. We’ll let the users bet on x number of products. Assume the minimum bid is $100 (their bid must be at least the minimum). */

#include<stdio.h>

#include<stdbool.h>

#define minBid 100.00

 

//Putting all function headers to top

__1__ __2__ scanProdInfo();

__3__ printProdInfo(__4__ __5__ p);

__6__ checkValid(__7__ amt);

 

//Define struct product

__8__ __9__

{

            __10__ ID;

            __11__ bid_amt;

};

 

int main()

{

            __12__ num_prod; //to save the number of products

            __13__ total = __14__; //variable for the total

 

            printf("Welcome to the Auction House.\n");

            printf("Enter number of products you want to bid on: ");

            scanf("__15__", __16__);

            //create an array of struct to save all the products

            __17__ __18__ bidProds[__19__];

 

            /*call the function to get 1 product info

              and save it to the array struct of products

            1 line loop body doesnt require {}*/

            for(int prod_idx = 0; prod_idx <__20__; prod_idx++)

                        __21__[__22__] = scanProdInfo();

           

            printf("\nThank you for your bids. Printing back: \n");

            for(int i = 0; i < __23__; i++)

            {

                        //call the function to print one product

                        printProdInfo(__24__[__25__]);

                        //add the product's amount to the total

                        total += __26__[__27__].__28__;

            }         

            //Print the total outside of loop

            printf("Your total bid amount is $%.2f.\n", __29__);

            return 0;

}

 

//get the information fo one product

__30__ __31__ scanProdInfo()

{

            struct prod p;

            printf("Enter 2 values for the product you're looking for (ID, then amt): ");

            scanf("%d __32__", __33__, __34__);

            bool isValid = checkValid(__35__); //check if the inputed amount is valid

 

            //ask user to re-enter if the input is valid (bid too low)

            while(__36__)

            {

                        printf("Your bid is too low for product #%d.", p.ID);

                        printf(" Re-enter the amount: ");

                        scanf("__37__", __38__);

                        __39__ = checkValid(__40__);

            }

            return __41__; //return the product

}

 

//print one product's info

__42__ printProdInfo(__43__ __44__ pr)

{

            printf("Product ID #%d: $%.2f.\n", __45__, __46__);

}

 

/*Check if the amount entered is not less than the mininum bid

and return true or false accordingly*/

__47__ checkValid(__48__ amt)

{

            return(amt __49__ __50__) ? true : false;

}

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr