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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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