1. For 2nd part of input (the real telephone log), avoid using getline(). Use cin >> instead
2. The presentation format seems does not matter
3. Remove illegal IDD and STD code by checking their country code / area code length
4. Validate the telephone number even when the code match, by their subscriber's length
TESTS:
088925 Broadwood0000000baaaaaaad$81
03 Arrowtown $38
01 $24
0061 Australia$140
00852 Hong Kong.012345678901234$1111
00 Los Angelos$10
000000
031526 22
0889256287213 122
008520123456789 64
779760 1
002832769 5
001234 1
0123456 3
0123 4
00134 5
00123456789012 9
0061234 600
0061853279 300
00611234567890 700
006112345678901 800
123456789 2
123456789012345 4
#
OUTPUT
031526 Arrowtown 1526 22 0.38 8.36
0889256287213 Broadwood0000000baaaaaaad 6287213 122 0.81 98.82
008520123456789 Hong Kong.012345678901234 0123456789 64 11.11 711.04
779760 Local 779760 1 0.00 0.00
002832769 Unknown 5 -1.00
001234 Unknown 1 -1.00
0123456 23456 3 0.24 0.72
0123 Unknown 4 -1.00
00134 Unknown 5 -1.00
00123456789012 Unknown 9 -1.00
0061234 Unknown 600 -1.00
0061853279 Australia 853279 300 1.40 420.00
00611234567890 Australia 1234567890 700 1.40 980.00
006112345678901 Unknown 800 -1.00
123456789 Local 123456789 2 0.00 0.00
123456789012345 Local 123456789012345 4 0.00 0.00
沒有留言:
張貼留言