In an effort to find something to do during self-quarantine, your friend flips a coin many...

90.2K

Verified Solution

Question

Programming

In an effort to find something to do during self-quarantine,your friend flips a coin many times and carefully records theresult of each flip in a character vector using either H or T.Write a function named greatestRun that receives this characterarray and then analyzes it to find the largest number ofconsecutive heads or tails. It must return two values: (1) thenumber corresponding to how many heads or tails were thrown in arow and (2) the character H or T depending upon whether it wasHeads or Tails that was thrown the most times. In the event of atie for the longest run, return the character B for both

Please solve the Heads-or-Tails problem in C or C++ using eitherWindows or Linux. Read the H-or-T data from
a below file or from STDIN. Report the result and relatedstatistics to STDOUT. Report any errors to
STDERR:

File: HTHHTTTHHTHHHTHTHTHHHHHTTHHHHHHHHHHHHTTTTTTTTTH

Answer & Explanation Solved by verified expert
4.0 Ratings (537 Votes)
USING TOSSTXT FILE FOR INPUTSUSING STRUCT finalAns to send output fromgreatestRunAttempted in C using windowsCode for the following questioninclude using namespace stdstruct    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students