Menu

[Solved] Output Following Https Ibbco 4vbnhhy Define Crtsecurenowarnings Used Scanf Work Include Us Q37188065

The output should be the following: https://ibb.co/4VBNhhy

#define _CRT_SECURE_NO_WARNINGS // used to all scanf to work

#include <stdio.h> // used for printf and scanffunctions

#define COLOR_SIZE 50

#define PLANT_ARRAY_SIZE 3

// struct definition called Plant goes here

// The first member variable is an integer called plantID whichrepresents the ID of the plant.

// The second member variable is an double called price whichrepresents the price of the plant.

// The third member variable is a character array called colorwhich will be the size of COLOR_SIZE

// which is already defined above. The color character arrayrepresents the perdominent color of the plant.

// function prototypes go here

int main()

{

    

    // create an array of Plant structscalled totalPlants of size PLANT_ARRAY_SIZE here.

    // PLANT_ARRAY_SIZE is already definedabove

    // Create a loop that traverses thetotalPlants array. Each element of the totalPlants array

    // will be initialized by the user. Callthe function initializePlant() for each element of the

    // totalPlants array to initial eachelement of the totalPlants array.

    // find the index (element number) ofthe cheapest plant in the totalPlants array

    // using the findCheapestPlantfunction.

    // display the cheapest plant that wasfound using the displayPlant() function.

    

    return 0;

}

//Refer to page 20 in the structs power point for

// The function initializePlant() has 1 input paramter.

// 1) input parameter named x is a pointer to the structPlant.

// The function initializePlant() does not return a value(void).

// The function initializePlant() will separately query the userto enter each element

// of the struct that is pointed to by x. Each user entry willbe saved in the

// struct that is pointed to by x.

// The function displayPlant() has 1 input paramter.

// 1) input parameter named x is a pointer to the structPlant.

// The function displayPlant() does not return a value(void).

// The function displayPlant() will display to the user thecontents of the struct

// that is pointed to by x. The format should be the Plant IDfollowed by the price

// of the plant followed by the color of the plant.

// Refer to page 18 in ppt

// The function findCheapestPlant() has 2 input paramters.

// 1) the input parameter named x is an array of Plantstructs.

// 2) the input parameter named length is the length of thearray x.

// The function findCheapestPlant() will return an integer.

// The function findCheapestPlant() will find the Plant structelement that

// has the cheapest price. The index to the cheapest plant isthe return value.

// If the length is 0 or lower then a -1 is returned as theindex.

Expert Answer


Answer to The output should be the following: https://ibb.co/4VBNhhy #define _CRT_SECURE_NO_WARNINGS // used to all scanf to work … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *