Price Calculation using Number Prefixes

Project Overview

Some telephone operators have submitted their price lists including price per minute for different phone number prefixes. The price lists look like this:

Operator A:

1                0.9

2               68 5.1

46              0.17

4620         0.00

468            0.15

4631           0.15

4673          0.9

46732        1.1

Operator B:

1                0.92

44             0.5

46             0.2

467           1.0

48             1.2

And so on...

Solution

The left column represents the telephone prefix (country + area code) and the right column represents the operator's price per minute for a number starting with that prefix. When several prefixes match the same number, the longest one should be used. If you, for example, dial +46-73-212345 you will have to pay $ 1.1/min with Operator A and $ 1.0/min with Operator B.

If a price list does not include a certain prefix you cannot use that operator to dial numbers starting with that prefix. For example, it is not possible to dial +44 numbers with operator A but it is possible with Operator B.

Software

Codeblocks

Programming Language

C++

The solution to the above problem can be found at https://github.com/tejaswinrao/Telecom-Operator

Create your website for free! This website was made with Webnode. Create your own for free today! Get started