Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ for beginner 1. The text file babynames2012.txt, which is included in the source code for this book and is available online from the books

C++ for beginner

1. The text file babynames2012.txt, which is included in the source code for this book and is available online from the books Web site, contains a list of the 1000 most popular boy and girl names in the United States for the year 2012 as compiled by the Social Security Administration.

This is a space-delimited file of 1000 entries in which the rank is listed first, followed by the corresponding boy name and girl name. The most popular names are listed first and the least popular names are listed last.

For example, the file begins with

1 Jacob Sophia

2 Mason Emma

3 Ethan Isabella

This indicates that Jacob is the most popular boy name and Sophia is the most popular girl name. Mason is the second most popular boy name and Emma is the second most popular girl name.

Write a program that allows the user to input a name. The program should then read from the file and search for a matching name among the girls and boys. If a match is found, it should output the rank of the name. The program should also indicate if there is no match.

For example, if the user enters the name Justice, then the program should output:

Justice is ranked 519 in popularity among boys.

Justice is ranked 518 in popularity among girls.

If the user enters the name Walter, then the program should output:

Walter is ranked 376 in popularity among boys.

Walter is not ranked among the top 1000 girl names.

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions