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

  Explain the interaction framework

Explain the Interaction Framework discussed by Steven Heim (2008). Choose a computing device (like an ATM machine or the self-check-out at a grocery store

  Create two global varibles to declare an empty array

Need to create two global varibles. The first currentTab, which will reference the current menu tab being dispalyed with a initial value of null, the second variable is maxZ which will store the z-index and it's initial value is 1.

  Write program to enter current value of car

Write a program that asks the user to enter the current value of a car. For a new car, it is the selling price of the car. The program should display the number of years it takes for the car's trade-in value to be below $1000.

  What are the contents of given register

Memory location 2000H has the word 5000H stored in it. What does each location contain after INC BYTE PTR[2000H]. Also after DEC WORD PTR[2000H]

  Design program that allows clerk to go through cards

Design a program that allows a clerk to go through the cards, entering the district for each citizen until an appropriate sentinel value is entered.

  Create program to enter expenses for the month

Create a program which asks the user to enter amount that he or she has budgeted for month. (For example: $2,000.00) A loop must then prompt the user to enter each of his or her expenses for month.

  Write and implement generic set class with attributes

Write and implement the generic Set class with attributes you find essential and with the following methods. Set class has nonduplicate elements.

  Show how the tree might be type-checked

Attempt to derive proof tree for the judgment Show how the tree might be type-checked

  Write a code to locate and rank keywords

You are working on the custom Web application to design document library for client. Write code to locate and rank the keywords. You have been given sample document to use for testing.

  Write functions to implement split-mergesort for files

Write functions to implement the split, merge, and mergesort algorithms for files. Also, write driver programs to test the given functions.

  Compute and display total number of votes received

Display the table with appropriate labels for the rows and columns. Compute and display the total number of votes received by each candidate and the percentage of the total votes cast.

  Write java program which declares the array alpha

Write the Java program which declares the array alpha of 50 elements. Initialize array so that first 25 elements are equal to square of the index variable and the last 25 elements

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