Write a C++ program to get a list of usernames from the user, store it in a set and print the size of the set. Print " Invalid number " if the number of usernames to be added is less than or equal to zero. In the main method, obtain input from the user in the console and insert the username into the set. Display the size of the set in the main method. Problem constraints: Use container to store the values. Use insert() method to insert the values.
Write a C++ program to get a list of usernames from the user, store it in a set and print the size of the set. Print " Invalid number " if the number of usernames to be added is less than or equal to zero. In the main method, obtain input from the user in the console and insert the username into the set. Display the size of the set in the main method. Problem constraints: Use container to store the values. Use insert() method to insert the values.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
QUESTION PROVIDED IN ATTACHMENT . KINDLY SEE
![It's Allen's mother's 50th birthday and they planned to throw a surprise party for her. Since
they want to invite all her friends, relatives, and acquaintances, they decide each and every
family member will keep telling the name of people who know Allen's mother and make a list.
Since every person can suggest any number of names and two people can suggest the same
name so to avoid the confusion Allen's Uncle suggests to make a set of names which stores
only unique element.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All
class names, member variable names, and function names should be the same as specified
in the problem statement.
Write a C++ program to get a list of usernames from the user, store it in a set and print the
size of the set. Print " Invalid number " if the number of usernames to be added is less than or
equal to zero.
In the main method, obtain input from the user in the console and insert the username into
the set. Display the size of the set in the main method.
Problem constraints:
Use <set> container to store the values.
Use insert() method to insert the values.
Input format:
The first line of input consists of an integer n that corresponds to the number of usernames to
be added
Next, n lines correspond to a string that corresponds to the username.
Output format:
The output consists of an integer that corresponds to the size of the set.
If the number of usernames to be added is less than or equal to zero display "Invalid number
Refer sample Input and Output for formatting specifications.
[All text in bold corresponds to input and the rest corresponds to output]
Sample Input and Output 1:
Enter the number of usernames to be added:
3
Enter the name of user 1
Enter the name:
arjun
Enter the name of user 2
Enter the name:
siva
Enter the name of user 3
Enter the name:
siva
Size of the set is:2
Sample Input and Output 2:
Enter the number of usernames to be added:
-5
Invalid number](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F8deb4dee-94e2-4016-aac5-3aeff4bdb06f%2F7dff67e5-2654-4841-af56-029bdd51da62%2F6yiha8q_processed.png&w=3840&q=75)
Transcribed Image Text:It's Allen's mother's 50th birthday and they planned to throw a surprise party for her. Since
they want to invite all her friends, relatives, and acquaintances, they decide each and every
family member will keep telling the name of people who know Allen's mother and make a list.
Since every person can suggest any number of names and two people can suggest the same
name so to avoid the confusion Allen's Uncle suggests to make a set of names which stores
only unique element.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All
class names, member variable names, and function names should be the same as specified
in the problem statement.
Write a C++ program to get a list of usernames from the user, store it in a set and print the
size of the set. Print " Invalid number " if the number of usernames to be added is less than or
equal to zero.
In the main method, obtain input from the user in the console and insert the username into
the set. Display the size of the set in the main method.
Problem constraints:
Use <set> container to store the values.
Use insert() method to insert the values.
Input format:
The first line of input consists of an integer n that corresponds to the number of usernames to
be added
Next, n lines correspond to a string that corresponds to the username.
Output format:
The output consists of an integer that corresponds to the size of the set.
If the number of usernames to be added is less than or equal to zero display "Invalid number
Refer sample Input and Output for formatting specifications.
[All text in bold corresponds to input and the rest corresponds to output]
Sample Input and Output 1:
Enter the number of usernames to be added:
3
Enter the name of user 1
Enter the name:
arjun
Enter the name of user 2
Enter the name:
siva
Enter the name of user 3
Enter the name:
siva
Size of the set is:2
Sample Input and Output 2:
Enter the number of usernames to be added:
-5
Invalid number
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY