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 nFollowingdata 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 nFollowingdata member, and returns true.
string Account:: getfollowingconst string& key const ;
This function is to perform a keyword search through the followingarray 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 nonempty 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 agetfollowing endl; showing the top tech influencers being followed:
ElonMusk JoannaStern GuyKawasak!
HarkZuckerberg
GrahamClutey
Larrykin
LewisHilsenteger
PaulAsadoorian
MarquesBrownlee GaryVaynerchuk
And here is a sample output of cout agetfollowing er endl; showing only those with the string er as part of their names.
MarkZuckerberg
Levishtisenteger
Joannastern
GaryWaynerchuk
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
