Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Latest commit

 

History

History

lab1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

lab1

English
中文(简体)

Discription

Solution to 'Bank Teller Service Problem' on Linux x86_64.

How to Use

Prerequisites

  • GNU Make
  • C++ compiler supporting C++11

Quick Start

To run the program, run:

$ make run <env>

The <env> can be:

  • CXX: Specify the C++ compiler. Defaults to g++
  • CXXFLAGS: Compiler options. Using the default value is recommended
  • NTELLER: The number of bank tellers. Defaults to 3
  • NCUSTOMER: The number of customers. Defaults to 10
  • MINSERVTIME: The minimum value of the time that customers will be served for. Defaults to 1
  • MAXSERVTIME: The maximum value of the time that customers will be served for. Defaults to 10
  • MINENTERTIME: The minimum value of the time when customers will enter the bank. Defaults to 1
  • MAXENTERTIME: The maximum value of the time when customers will enter the bank. Defaults to 10

For an example:

$ make run NTELLER=10 NCUSTOMER=20 MAXSERVTIME=5 MAXENTERTIME=40

Build the program

To just build the program, please run:

$ make

or

$ make build

Then the program will be built in src/target.

Generate test case

To generate a test case, please run:

$ make test <env>

The <env> can be NCUSTOMER, MINSERVTIME, MAXSERVTIME, MINENTERTIME or MAXENTERTIME. Just as introduced above.

To generate a new test case, run:

$ make retest <env>

Run test case

To run the test case generated by make test or make retest, please run:

$ make run NTELLER=<value>

If no test cases are generated before, it will generate a new test case, just as 'Quick Start' shows.

Input test case manually

Run:

$ make debug NTELLER=<value>

or run NTELLER=<value> src/target/main after building the program.

Then the program will wait for your keyboard input. The input format is:

  • Multilines
  • Each line contains three non-negative integers, split by spaces or tabs, representing one customer. The first integer is the customer's ID. The second integer is the time when the customer will enter the bank. The third integer is the time that the customer will be served for.

For example:

1 1 10
2 5 2
3 6 3

Clean the project

To delete all files generated when building, run:

$ make clean