C ++ For Statisticians: Solved Exercises: C++ Exercises, Practice, Solution by Laureano Gallardo
English | December 17, 2018 | ASIN: B07LFN5YQY | 14 pages | AZW3 | 0.16 MB
English | December 17, 2018 | ASIN: B07LFN5YQY | 14 pages | AZW3 | 0.16 MB
This book contains solved program on various popular topics of C++ Programming Language. I am going to implement programs on such topics which will definitely help you to increase your programming skills.
List of C++ programming solved programs/examples with solutions:
Example of Exercise:
We want to design a program that allows us to control the boxes of a supermarket so that it is more efficient to collect products to customers. The supermarket has 10 boxes to which customers can go. The owner of the supermarket has asked us to give him a program to indicate to the client that he is going to the boxes, in which of the boxes it will take less time, that is to say, in which of the boxes there are less products between the clients They wait in that box.
To do this, we will design a Savings Box class, which will allow you to handle this information and solve the problem raised. Specifically, the operations that this class must offer are:
Construction of the object Boxes Supermarket that will build the necessary data to operate the control of boxes, but without any client in any box. Build the empty structure.
int Products (int box): given a box (identified with a number from 1 to 10) returns the total number of products that customers are waiting to be served in the box.
int EmptyBox (): it will look for any box that does not have a client and in the affirmative it will return the identifier of the box that does not have clients. If no box is empty the method will return -1.
int ClientServit (int box): it will remove the client that is being served in the box that enters as a parameter, and therefore you will have to update how to match the corresponding data.
void AddClient (int id, int np): You will have to check everything that you touch and decide on which box you must tailor the customer with an id and purchase np products. If any box is free, you will have to put it in the free box, and if there is no free box, you must put it in that box that has fewer pending products to be charged.
NOTE: The Customer class may already be implemented, with the following specification:
Class Client
{
int Ident;
int Nprods;
Client (int id, int np)
Prec:
Post:
int identifier ()
Prec:
Post:
int NProducts ()
Prec:
Post:
}