SlideShare a Scribd company logo
1 of 3
Download to read offline
NEED HELP ASAP!!! doLikeTweet This function is used to add a "like" to the the currently
selected tweet. The function receives as parameters, the timeline containing the tweet, the current
number of tweets in the timeline, and the position number in the timeline of the currently
selected tweet. For safety, the function should first verify that the selected parameter is actually a
valid position within the used portion of the array. If it isn't the function should print the
message: No tweet is selected. If the position is valid, it should add 1 like to the tweet stored at
that position in the array. // Program to implement a very simplified list of tweets // from a single
simulated Twitter account // Tweets can be added, deleted, and liked #include using namespace
std; const int MSGSIZE = 100; // Maximum size for a tweet message const int CAPACITY = 10;
// Maximum number of tweets // Structure used to define a tweet entry struct Tweet { int id; char
msg[MSGSIZE]; int likes; }; /* * Prints out an entire timeline to the screen * timeline = timeline
of tweets to be printed * usedSize = number of tweets in the timeline * selected = position
number of currently selected tweet */ void displayTimeline(const Tweet timeline[], int usedSize,
int selected); /* * Edits currently selected tweet * with a new message entered by the user. *
timeline = timeline in which the tweet is to be edited * usedSize = number of tweets in the
timeline * selected = position number of currently selected tweet * If 'selected' represents a valid
array position, the * selected tweet will be updated. * If 'selected' is not valid a 'no tweet is
selected message' will be * displayed and no changes will be made. */ void doEditTweet(Tweet
timeline[], int usedSize, int selected); /* * Adds a like to the currently selected tweet. * timeline
= timeline in which the tweet is to be edited * usedSize = number of tweets in the timeline *
selected = position number of currently selected tweet * If 'selected' represents a valid array
position, the * selected tweet will be updated. * If 'selected' is not valid a 'no tweet is selected
message' will be * displayed and no changes will be made. */ void doLikeTweet(Tweet
timeline[], int usedSize, int selected); /* * Deleted currently selected tweet. * timeline = timeline
in from which the entry is to be deleted * usedSize = number of tweets in the timeline * If
'selected' represents a valid array position: * the selected tweet will be deleted * usedSize will be
updated to reflect the updated number of tweets in the timeline * selected will be updated to -1 *
If 'selected' is not valid a 'no tweet is selected message' will be * displayed and no changes will
be made. */ void doDeleteTweet(Tweet timeline[], int& usedSize, int& selected); /* * If there is
room in the timeline for new tweets, then this gets * a new tweet from the user and adds it to the
timeline. * timeline = timeline in which the tweet is to be added * usedSize = number of tweets
in the timeline * If tweet was able to be added, returns the position number in the * timeline of
where the item was added, and usedSize will be * updated to reflect the number of tweets now in
the timeline. * If tweet was not able to be added, returns -1, and usedSize * remains unchanged.
*/ int doAddTweet(Tweet timeline[], int& usedSize); /* * Adds a new tweet to the list * timeline
= timeline in which the entry is to be added * usedSize = number of tweets in the timeline *
message = tweet message to be added * If tweet was able to be added, returns the position
number in the * timeline of where the item was added, and usedSize will be * updated to reflect
the number of tweets now in the timeline. * If tweet was not able to be added, returns -1, and
usedSize * remains unchanged. */ int addTweet(Tweet timeline[], int& usedSize, const char
message[]); /* * Returns the next available ID number * timeline = timeline in which to find the
highest ID * usedSize = number of tweets in the timeline * If timeline is empty, returns 100; *
otherwise, returns 1 + highest ID number in the timeline */ int getNextId(Tweet timeline[], int
usedSize); /* * Gets a tweet id from the user. Searches a timeline to try * to find the specified
tweet by its id. * timeline = timeline to be searched * usedSize = number of tweets in the
timeline * If the tweet is found, the position number of where the tweet * is stored in the timeline
will be returned. If the tweet is * not found, a 'not found message' will be printed, and * the value
-1 will be returned. * If timeline is empty, an 'empty' message will be printed, and * the value -1
will be returned. */ int selectTweet(const Tweet timeline[], int usedSize); int main() { Tweet
timeline[CAPACITY]; // Twitter timeline int choice; // User's menu choice int usedSize = 0; //
Num of tweets in the timeline int selected = -1; // Currently selected tweet int tmp; // Temporary
variable // Add some starter entries for testing purposes selected = addTweet(timeline, usedSize,
"Where do they get the seeds to plant seedless watermelons?"); selected = addTweet(timeline,
usedSize, "Waffles are just pancakes with convenient boxes to hold your syrup."); selected =
addTweet(timeline, usedSize, "Last night I even struck up a conversation with a spider. Turns
out he's a web designer."); do { cout << "1. Display Timelinen"; cout << "2. Select Tweetn";
cout << "3. Add New Tweetn"; cout << "4. Edit Selected Tweetn"; cout << "5. Like Selected
Tweetn"; cout << "6. Delete Tweetn"; cout << "7. Exitn"; cout << endl; cout << "Select: "; //
Get the numeric entry from the menu cin >> choice; // Corrects issues where user might enter a
non-integer value while (cin.fail()) { cin.clear(); cin.ignore(numeric_limits::max(), 'n'); cout <<
"Select: "; cin >> choice; } // Makes the 'enter' key that was pressed after the numeric entry be
ignored // Should be used after getting any numeric input from the keyboard cin.ignore(); switch
(choice) { case 1: displayTimeline(timeline, usedSize, selected); break; case 2: tmp =
selectTweet(timeline, usedSize); // if selected tweet exists, update selected variable; // otherwise
leave it unchanged if (tmp > -1) selected = tmp; break; case 3: tmp = doAddTweet(timeline,
usedSize); // if tweet was added, make it be the selected tweet; // otherwise leave it unchanged if
(tmp > -1) selected = tmp; break; case 4: doEditTweet(timeline, usedSize, selected); break; case
5: doLikeTweet(timeline, usedSize, selected); break; case 6: doDeleteTweet(timeline, usedSize,
selected); break; } } while (choice != 7); return 0; } int doAddTweet(Tweet timeline[], int&
usedSize) { // TODO: Write code for the function return -1; } void doEditTweet(Tweet
timeline[], int usedSize, int selected) { // TODO: Write code for the function } void
doLikeTweet(Tweet timeline[], int usedSize, int selected) { // TODO: Write code for the
function } void displayTimeline(const Tweet timeline[], int usedSize, int selected) { // TODO:
Write code for the function } int addTweet(Tweet timeline[], int& usedSize, const char
message[]) { // TODO: Write code for the function return -1; } int getNextId(Tweet timeline[],
int usedSize) { // TODO: Write code for the function return 100; } void doDeleteTweet(Tweet
timeline[], int& usedSize, int& selected) { // TODO: Write code for the function }

More Related Content

More from mkagarwalma

Need Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdfNeed Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdfmkagarwalma
 
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdfNeed Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdfmkagarwalma
 
Nancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdfNancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdfmkagarwalma
 
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdfNakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdfmkagarwalma
 
Mountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdfMountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdfmkagarwalma
 
More than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdfMore than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdfmkagarwalma
 
Monique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdfMonique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdfmkagarwalma
 
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdfMesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdfmkagarwalma
 
Miguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdfMiguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdfmkagarwalma
 
Mia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdfMia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdfmkagarwalma
 
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdfMichael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdfmkagarwalma
 
Melchor is a senior executive of an Australian brewing company. The .pdf
Melchor is a senior executive of an Australian brewing company. The .pdfMelchor is a senior executive of an Australian brewing company. The .pdf
Melchor is a senior executive of an Australian brewing company. The .pdfmkagarwalma
 
Medya Okuryazarlnn kazandrd en �nemli veri analiz etmek, aratrmak, s.pdf
Medya Okuryazarlnn kazandrd en �nemli veri analiz etmek, aratrmak, s.pdfMedya Okuryazarlnn kazandrd en �nemli veri analiz etmek, aratrmak, s.pdf
Medya Okuryazarlnn kazandrd en �nemli veri analiz etmek, aratrmak, s.pdfmkagarwalma
 
n the illustration, the structure labeled #6 is the a. theca externa b.pdf
n the illustration, the structure labeled #6 is the a. theca externa b.pdfn the illustration, the structure labeled #6 is the a. theca externa b.pdf
n the illustration, the structure labeled #6 is the a. theca externa b.pdfmkagarwalma
 
multiple choose questions 1- The population of frogs gets divided in.pdf
multiple choose questions 1- The population of frogs gets divided in.pdfmultiple choose questions 1- The population of frogs gets divided in.pdf
multiple choose questions 1- The population of frogs gets divided in.pdfmkagarwalma
 
Msrda renkli bir al�ron, bir R alelinin varlndan kaynaklanr; rr ren.pdf
Msrda renkli bir al�ron, bir R alelinin varlndan kaynaklanr; rr ren.pdfMsrda renkli bir al�ron, bir R alelinin varlndan kaynaklanr; rr ren.pdf
Msrda renkli bir al�ron, bir R alelinin varlndan kaynaklanr; rr ren.pdfmkagarwalma
 
Ms. Vinsons work world began to change in mid-2000. With the teleco.pdf
Ms. Vinsons work world began to change in mid-2000. With the teleco.pdfMs. Vinsons work world began to change in mid-2000. With the teleco.pdf
Ms. Vinsons work world began to change in mid-2000. With the teleco.pdfmkagarwalma
 
MSOracleSAP tarafndan sunulan kurumsal sistemi (ad, tarih, mod�lle.pdf
MSOracleSAP tarafndan sunulan kurumsal sistemi (ad, tarih, mod�lle.pdfMSOracleSAP tarafndan sunulan kurumsal sistemi (ad, tarih, mod�lle.pdf
MSOracleSAP tarafndan sunulan kurumsal sistemi (ad, tarih, mod�lle.pdfmkagarwalma
 
Mr J Russia desires to protect and manage his assets for the benefit.pdf
Mr J Russia desires to protect and manage his assets for the benefit.pdfMr J Russia desires to protect and manage his assets for the benefit.pdf
Mr J Russia desires to protect and manage his assets for the benefit.pdfmkagarwalma
 
MERNNeed help to connect to PayPal with the code below1. I crea.pdf
MERNNeed help to connect to PayPal with the code below1. I crea.pdfMERNNeed help to connect to PayPal with the code below1. I crea.pdf
MERNNeed help to connect to PayPal with the code below1. I crea.pdfmkagarwalma
 

More from mkagarwalma (20)

Need Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdfNeed Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdf
 
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdfNeed Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
 
Nancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdfNancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdf
 
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdfNakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdf
 
Mountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdfMountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdf
 
More than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdfMore than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdf
 
Monique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdfMonique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdf
 
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdfMesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
 
Miguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdfMiguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdf
 
Mia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdfMia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdf
 
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdfMichael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
 
Melchor is a senior executive of an Australian brewing company. The .pdf
Melchor is a senior executive of an Australian brewing company. The .pdfMelchor is a senior executive of an Australian brewing company. The .pdf
Melchor is a senior executive of an Australian brewing company. The .pdf
 
Medya Okuryazarlnn kazandrd en �nemli veri analiz etmek, aratrmak, s.pdf
Medya Okuryazarlnn kazandrd en �nemli veri analiz etmek, aratrmak, s.pdfMedya Okuryazarlnn kazandrd en �nemli veri analiz etmek, aratrmak, s.pdf
Medya Okuryazarlnn kazandrd en �nemli veri analiz etmek, aratrmak, s.pdf
 
n the illustration, the structure labeled #6 is the a. theca externa b.pdf
n the illustration, the structure labeled #6 is the a. theca externa b.pdfn the illustration, the structure labeled #6 is the a. theca externa b.pdf
n the illustration, the structure labeled #6 is the a. theca externa b.pdf
 
multiple choose questions 1- The population of frogs gets divided in.pdf
multiple choose questions 1- The population of frogs gets divided in.pdfmultiple choose questions 1- The population of frogs gets divided in.pdf
multiple choose questions 1- The population of frogs gets divided in.pdf
 
Msrda renkli bir al�ron, bir R alelinin varlndan kaynaklanr; rr ren.pdf
Msrda renkli bir al�ron, bir R alelinin varlndan kaynaklanr; rr ren.pdfMsrda renkli bir al�ron, bir R alelinin varlndan kaynaklanr; rr ren.pdf
Msrda renkli bir al�ron, bir R alelinin varlndan kaynaklanr; rr ren.pdf
 
Ms. Vinsons work world began to change in mid-2000. With the teleco.pdf
Ms. Vinsons work world began to change in mid-2000. With the teleco.pdfMs. Vinsons work world began to change in mid-2000. With the teleco.pdf
Ms. Vinsons work world began to change in mid-2000. With the teleco.pdf
 
MSOracleSAP tarafndan sunulan kurumsal sistemi (ad, tarih, mod�lle.pdf
MSOracleSAP tarafndan sunulan kurumsal sistemi (ad, tarih, mod�lle.pdfMSOracleSAP tarafndan sunulan kurumsal sistemi (ad, tarih, mod�lle.pdf
MSOracleSAP tarafndan sunulan kurumsal sistemi (ad, tarih, mod�lle.pdf
 
Mr J Russia desires to protect and manage his assets for the benefit.pdf
Mr J Russia desires to protect and manage his assets for the benefit.pdfMr J Russia desires to protect and manage his assets for the benefit.pdf
Mr J Russia desires to protect and manage his assets for the benefit.pdf
 
MERNNeed help to connect to PayPal with the code below1. I crea.pdf
MERNNeed help to connect to PayPal with the code below1. I crea.pdfMERNNeed help to connect to PayPal with the code below1. I crea.pdf
MERNNeed help to connect to PayPal with the code below1. I crea.pdf
 

Recently uploaded

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 

Recently uploaded (20)

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 

NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf

  • 1. NEED HELP ASAP!!! doLikeTweet This function is used to add a "like" to the the currently selected tweet. The function receives as parameters, the timeline containing the tweet, the current number of tweets in the timeline, and the position number in the timeline of the currently selected tweet. For safety, the function should first verify that the selected parameter is actually a valid position within the used portion of the array. If it isn't the function should print the message: No tweet is selected. If the position is valid, it should add 1 like to the tweet stored at that position in the array. // Program to implement a very simplified list of tweets // from a single simulated Twitter account // Tweets can be added, deleted, and liked #include using namespace std; const int MSGSIZE = 100; // Maximum size for a tweet message const int CAPACITY = 10; // Maximum number of tweets // Structure used to define a tweet entry struct Tweet { int id; char msg[MSGSIZE]; int likes; }; /* * Prints out an entire timeline to the screen * timeline = timeline of tweets to be printed * usedSize = number of tweets in the timeline * selected = position number of currently selected tweet */ void displayTimeline(const Tweet timeline[], int usedSize, int selected); /* * Edits currently selected tweet * with a new message entered by the user. * timeline = timeline in which the tweet is to be edited * usedSize = number of tweets in the timeline * selected = position number of currently selected tweet * If 'selected' represents a valid array position, the * selected tweet will be updated. * If 'selected' is not valid a 'no tweet is selected message' will be * displayed and no changes will be made. */ void doEditTweet(Tweet timeline[], int usedSize, int selected); /* * Adds a like to the currently selected tweet. * timeline = timeline in which the tweet is to be edited * usedSize = number of tweets in the timeline * selected = position number of currently selected tweet * If 'selected' represents a valid array position, the * selected tweet will be updated. * If 'selected' is not valid a 'no tweet is selected message' will be * displayed and no changes will be made. */ void doLikeTweet(Tweet timeline[], int usedSize, int selected); /* * Deleted currently selected tweet. * timeline = timeline in from which the entry is to be deleted * usedSize = number of tweets in the timeline * If 'selected' represents a valid array position: * the selected tweet will be deleted * usedSize will be updated to reflect the updated number of tweets in the timeline * selected will be updated to -1 * If 'selected' is not valid a 'no tweet is selected message' will be * displayed and no changes will be made. */ void doDeleteTweet(Tweet timeline[], int& usedSize, int& selected); /* * If there is room in the timeline for new tweets, then this gets * a new tweet from the user and adds it to the timeline. * timeline = timeline in which the tweet is to be added * usedSize = number of tweets in the timeline * If tweet was able to be added, returns the position number in the * timeline of where the item was added, and usedSize will be * updated to reflect the number of tweets now in the timeline. * If tweet was not able to be added, returns -1, and usedSize * remains unchanged. */ int doAddTweet(Tweet timeline[], int& usedSize); /* * Adds a new tweet to the list * timeline
  • 2. = timeline in which the entry is to be added * usedSize = number of tweets in the timeline * message = tweet message to be added * If tweet was able to be added, returns the position number in the * timeline of where the item was added, and usedSize will be * updated to reflect the number of tweets now in the timeline. * If tweet was not able to be added, returns -1, and usedSize * remains unchanged. */ int addTweet(Tweet timeline[], int& usedSize, const char message[]); /* * Returns the next available ID number * timeline = timeline in which to find the highest ID * usedSize = number of tweets in the timeline * If timeline is empty, returns 100; * otherwise, returns 1 + highest ID number in the timeline */ int getNextId(Tweet timeline[], int usedSize); /* * Gets a tweet id from the user. Searches a timeline to try * to find the specified tweet by its id. * timeline = timeline to be searched * usedSize = number of tweets in the timeline * If the tweet is found, the position number of where the tweet * is stored in the timeline will be returned. If the tweet is * not found, a 'not found message' will be printed, and * the value -1 will be returned. * If timeline is empty, an 'empty' message will be printed, and * the value -1 will be returned. */ int selectTweet(const Tweet timeline[], int usedSize); int main() { Tweet timeline[CAPACITY]; // Twitter timeline int choice; // User's menu choice int usedSize = 0; // Num of tweets in the timeline int selected = -1; // Currently selected tweet int tmp; // Temporary variable // Add some starter entries for testing purposes selected = addTweet(timeline, usedSize, "Where do they get the seeds to plant seedless watermelons?"); selected = addTweet(timeline, usedSize, "Waffles are just pancakes with convenient boxes to hold your syrup."); selected = addTweet(timeline, usedSize, "Last night I even struck up a conversation with a spider. Turns out he's a web designer."); do { cout << "1. Display Timelinen"; cout << "2. Select Tweetn"; cout << "3. Add New Tweetn"; cout << "4. Edit Selected Tweetn"; cout << "5. Like Selected Tweetn"; cout << "6. Delete Tweetn"; cout << "7. Exitn"; cout << endl; cout << "Select: "; // Get the numeric entry from the menu cin >> choice; // Corrects issues where user might enter a non-integer value while (cin.fail()) { cin.clear(); cin.ignore(numeric_limits::max(), 'n'); cout << "Select: "; cin >> choice; } // Makes the 'enter' key that was pressed after the numeric entry be ignored // Should be used after getting any numeric input from the keyboard cin.ignore(); switch (choice) { case 1: displayTimeline(timeline, usedSize, selected); break; case 2: tmp = selectTweet(timeline, usedSize); // if selected tweet exists, update selected variable; // otherwise leave it unchanged if (tmp > -1) selected = tmp; break; case 3: tmp = doAddTweet(timeline, usedSize); // if tweet was added, make it be the selected tweet; // otherwise leave it unchanged if (tmp > -1) selected = tmp; break; case 4: doEditTweet(timeline, usedSize, selected); break; case 5: doLikeTweet(timeline, usedSize, selected); break; case 6: doDeleteTweet(timeline, usedSize, selected); break; } } while (choice != 7); return 0; } int doAddTweet(Tweet timeline[], int& usedSize) { // TODO: Write code for the function return -1; } void doEditTweet(Tweet timeline[], int usedSize, int selected) { // TODO: Write code for the function } void
  • 3. doLikeTweet(Tweet timeline[], int usedSize, int selected) { // TODO: Write code for the function } void displayTimeline(const Tweet timeline[], int usedSize, int selected) { // TODO: Write code for the function } int addTweet(Tweet timeline[], int& usedSize, const char message[]) { // TODO: Write code for the function return -1; } int getNextId(Tweet timeline[], int usedSize) { // TODO: Write code for the function return 100; } void doDeleteTweet(Tweet timeline[], int& usedSize, int& selected) { // TODO: Write code for the function }