SlideShare a Scribd company logo
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.pdf
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 
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
mkagarwalma
 

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

Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 

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 }