Question: bool Account: : follow ( const string& username ) ; This function is to return false if the invoking account is already following the username

bool Account: : follow (const string& username);
This function is to return false if the invoking account is already following the username provided or the array is already at its capacity. No change shall then be made to any data member of the invoking account. Otherwise, it adds the username to the following_ array data member, updates the nFollowing_data member, and retums true.
bool Account: :unfollow (const string& username) ;
This function is to return false if the invoking account is not currently following the usemame provided. No change shall then be made to any data member of the invoking account. Otherwise, it removes the usemame from the following_ array data member by shifting the related elements forward, updates the nFollowing_data member, and returns true.
string Account:: get_following(const string& key ="") const ;
This function is to perform a keyword search through the following_array and return a string of all matching usernames, formatted in a nice tabular format. You are required to use a stringstream object along with parametric manipulator to help you organize the format of the string to be returned. It shall not change any of the data members of the object. If no match is found, the function shall return an empty string.
By default, the value for key is an empty string, indicating the returned string of the function shall include all usernames in the following_ array, from the oldest to the newest. However, if a non-empty string is presented for the key parameter, the returned string shall include only usernames containing the key as its substring.
For example, here is a sample output of cout a.get_following () endl; showing the top 10 tech influencers being followed:
ElonMusk JoannaStern GuyKawasak!
HarkZuckerberg
GrahamClutey
Larrykin
LewisHilsenteger
PaulAsadoorian
MarquesBrownlee GaryVaynerchuk
And here is a sample output of cout a,get_following ("er") endl; showing only those with the string "er" as part of their names.
MarkZuckerberg
Levishtisenteger
Joannastern
GaryWaynerchuk
 bool Account: : follow (const string& username); This function is to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!