Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING C++ Write a program to search for area codes using the binary search. Use the recursive function from our text. The file with area

USING C++ Write a program to search for area codes using the binary search. Use the recursive function from our text.

The file with area codes is attached. USE THE FILE AS IS - do not change it.

Read the area codes into an array. Then ask the end user which area code they want to search for - output whether it is in the list or not.

Test on several cases - at least one one the list and at least one that is not on the list. This should be in a loop.

Note: the file has the name of the place for the area code - you can ignore this value (unless you choose to do the extra credit).

Remember that cin is blank delimited so do not use cin for the names - you can use getline.

Extra credit - If the area code is in the list, also print the name of the place.

"areaCodes.txt"

This is what is included in the .txt file:

201 New Jersey 202 District of Columbia 203 Connecticut 205 Alabama 206 Washington 207 Maine 208 Idaho 209 California 210 Texas 212 New York 213 California 214 Texas 215 Pennsylvania 216 Ohio 217 Illinois 218 Minnesota 219 Indiana 224 Illinois 225 Louisiana 228 Mississippi 229 Georgia 231 Michigan 234 Ohio 239 Florida 240 Maryland 248 Michigan 251 Alabama 252 North Carolina 253 Washington 254 Texas 256 Alabama 260 Indiana 262 Wisconsin 267 Pennsylvania 269 Michigan 270 Kentucky 276 Virginia 278 Michigan 281 Texas 283 Ohio 301 Maryland 302 Delaware 303 Colorado 304 West Virginia 305 Florida 307 Wyoming 308 Nebraska 309 Illinois 310 California 312 Illinois 313 Michigan 314 Missouri 315 New York 316 Kansas 317 Indiana 318 Louisiana 319 Iowa 320 Minnesota 321 Florida 323 California 325 Texas 330 Ohio 331 Illinois 334 Alabama 336 North Carolina 337 Louisiana 339 Massachusetts 340 US Virgin Islands 341 California 347 New York 351 Massachusetts 352 Florida 360 Washington 361 Texas 369 California 380 Ohio 385 Utah 386 Florida 401 Rhode Island 402 Nebraska 404 Georgia 405 Oklahoma 406 Montana 407 Florida 408 California 409 Texas 410 Maryland 412 Pennsylvania 413 Massachusetts 414 Wisconsin 415 California 417 Missouri 419 Ohio 423 Tennessee 424 California 425 Washington 430 Texas 432 Texas 434 Virginia 435 Utah 440 Ohio 442 California 443 Maryland 464 Illinois 469 Texas 470 Georgia 475 Connecticut 478 Georgia 479 Arkansas 480 Arizona 484 Pennsylvania 501 Arkansas 502 Kentucky 503 Oregon 504 Louisiana 505 New Mexico 507 Minnesota 508 Massachusetts 509 Washington 510 California 512 Texas 513 Ohio 515 Iowa 516 New York 517 Michigan 518 New York 520 Arizona 530 California 539 Oklahoma 540 Virginia 541 Oregon 551 New Jersey 557 Missouri 559 California 561 Florida 562 California 563 Iowa 564 Washington 567 Ohio 570 Pennsylvania 571 Virginia 573 Missouri 574 Indiana 575 New Mexico 580 Oklahoma 585 New York 586 Michigan 601 Mississippi 602 Arizona 603 New Hampshire 605 South Dakota 606 Kentucky 607 New York 608 Wisconsin 609 New Jersey 610 Pennsylvania 612 Minnesota 614 Ohio 615 Tennessee 616 Michigan 617 Massachusetts 618 Illinois 619 California 620 Kansas 623 Arizona 626 California 627 California 628 California 630 Illinois 631 New York 636 Missouri 641 Iowa 646 New York 650 California 651 Minnesota 657 California 660 Missouri 661 California 662 Mississippi 669 California 670 Northern Mariana Islands 671 Guam 678 Georgia 679 Michigan 681 West Virginia 682 Texas 689 Florida 701 North Dakota 702 Nevada 703 Virginia 704 North Carolina 706 Georgia 707 California 708 Illinois 712 Iowa 713 Texas 714 California 715 Wisconsin 716 New York 717 Pennsylvania 718 New York 719 Colorado 720 Colorado 724 Pennsylvania 727 Florida 731 Tennessee 732 New Jersey 734 Michigan 737 Texas 740 Ohio 747 California 754 Florida 757 Virginia 760 California 762 Georgia 763 Minnesota 764 California 765 Indiana 769 Mississippi 770 Georgia 772 Florida 773 Illinois 774 Massachusetts 775 Nevada 779 Illinois 781 Massachusetts 785 Kansas 786 Florida 787 Puerto Rico 801 Utah 802 Vermont 803 South Carolina 804 Virginia 805 California 806 Texas 808 Hawaii 810 Michigan 812 Indiana 813 Florida 814 Pennsylvania 815 Illinois 816 Missouri 817 Texas 818 California 828 North Carolina 830 Texas 831 California 832 Texas 835 Pennsylvania 843 South Carolina 845 New York 847 Illinois 848 New Jersey 850 Florida 856 New Jersey 857 Massachusetts 858 California 859 Kentucky 860 Connecticut 862 New Jersey 863 Florida 864 South Carolina 865 Tennessee 870 Arkansas 872 Illinois 878 Pennsylvania 901 Tennessee 903 Texas 904 Florida 906 Michigan 907 Alaska 908 New Jersey 909 California 910 North Carolina 912 Georgia 913 Kansas 914 New York 915 Texas 916 California 917 New York 918 Oklahoma 919 North Carolina 920 Wisconsin 925 California 927 Florida 928 Arizona 931 Tennessee 935 California 936 Texas 937 Ohio 939 Puerto Rico 940 Texas 941 Florida 947 Michigan 949 California 951 California 952 Minnesota 954 Florida 956 Texas 957 New Mexico 959 Connecticut 970 Colorado 971 Oregon 972 Texas 973 New Jersey 975 Missouri 978 Massachusetts 979 Texas 980 North Carolina 984 North Carolina 985 Louisiana 989 Michigan

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions