Write program which asks user for names

Assignment Help Programming Languages
Reference no: EM1384508

Create a class Person with the following fields:

name
a pointer to the person's best friend (a Person*)
a popularity counter that indicates how many other people have this person as their best friend

Write down a program which asks user for names (Prompt user with something like "Enter a name, or q when finished"), assigns new Person (in heap memory) for each of them, and stores resulting pointer in vector . Next, ask for name of best friend for each of Person objects. (Use loop similar to the one which takes original input, this time with prompt like "Enter name of so-and-so's best friend") Locate object matching friend's name and call member function(s) to update pointer and popularity counter fields. At last, print all Person objects, listing the name, best friend, and popularity counter for each.

User input is to be taken one piece at time, but names are permitted to have spaces (like Bob Smith). You may suppose that user will only input "best friends" which are from the list of people which were entered.

Reference no: EM1384508

Questions Cloud

Determine the final volume : Assume your lab partner leaves in the middle of making a 50mM NaCl solution. You know that they transferred 6mls of a 250mM stock solution into a beaker,
Electron and hole motions in a p-n junction : Briefly describe electron and hole motions in a p-n junction for forward and reverse biases; then explain how these lead to rectification.
Patricia admitted signing the note : Manuel sued Patricia on a promissory note. Patricia admitted signing the note, but rose the defence which Manuel was not a holder in due course. Can Manuel recover without proving which he is a holder in due course?
Impact building on l oreals competitive capabilities : determine the one program which is having the most impact on building on L'Oreal's competitive capabilities. State your rationale.
Write program which asks user for names : Write down a program which asks user for names (Prompt user with something like "Enter a name, or q when finished"), assigns new Person (in heap memory) for each of them.
Elucidate why do companies using a horizontal structure : Elucidate why do companies using a horizontal structure have cultures which emphasize openness, employee empowerment, and responsibility?
Maximum and minimum stress intensities in the section : Determine the maximum and minimum stress intensities in the section.
Devise a test to detect the prostate specific protease : The PSA test is the most widely used test to detect prostate cancer. The PSA marker is a protease that is manufactured specifically in the prostate gland.
Illustrate what is a product life cycle : Illustrate what is a product life cycle and elucidate how can the concept be applied to one of your project company's products?

Reviews

Write a Review

Programming Languages Questions & Answers

  Create program to keep track of game collection

You wish to create a program which will keep track of the game collection at home. The program must recognize the platform.

  Write modular program to enter integers for sorting

Write a modular program that performs the following functions: Allows the user to enter 10 integers for sorting, Allows the user to select one of the two types of sorting techniques.

  Write function to compute average temperature for the month

Write the function, print_temps(), with same two parameters plus count of hot days. Print neat table of temperatures. At same time, compute average temperature for the month.

  Program to read employee information into array of objects

Consider a program that will read employee information into an array of objects, sort the array by employee identification number, write out the sorted array.

  Designing navigation system for point-and-click system

Design a navigation system or menu allows Access to act like point-and-click system. Write down some of the kinds of navigation.

  Design and implement class instance data for title of book

Design and implement a class called Book that contains instance data for the title, author, publisher, and copyright date. Define the Book constructor to accept and initialize this data.

  Determine branch folding for unconditional branches

Determine the improvement from branch folding for unconditional branches. Assume a 90% hit rate, a base CPI without unconditional branch stalls of 1.

  Implement to do a matrix-matrix product

Implement and check the time to do a matrix-matrix product of a 1000x500 matrix with a 500x800 matrix of floats sequentially and using 1,2,3,4, and 8 threads on dual and quad core processors.

  Explaining tags used for effective page layout

Page layout is one of the most time consuming tasks for a web designer. What are some of the tags used for effective page layout and how do they work?

  Design program that stores information of products

You are asked to design a program that stores information of given products. Your program must be menu driven. The program menu must include the following options: Add product information (Ask user to input product id, name and price)

  Write program to bounce blue ball inside jpanel

Write a program which bounces the blue ball inside JPanel. Ball must begin moving with the mousePressed event. When ball hits edge of JPanel, it must bounce off edge.

  Create the logic for the application fast-food resturant

Create the logic for the application which permits a user to enter the ordered item continuosly until sentinel value is entered.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd