Hi everyone! I would really appreciate any help that I can get on this problem.
My professor asigned us a project where you create a program that essentially simulates coin flips. The first step in the program is to ask the user how many times they want to flip the coin. Regardless of how many times they choose to flip the coin the program needs to print the result of each flip whether it's heads or tails. I have all of that done i can't figure out how to implement the last step which is to display the maximum consecutive heads and tails that appear in the results from the coin toss'.
Here is the code that I have so far:
'10/11/2006
'Heads or tails program
INPUT "How many times do you want to flip the coin?: " ;flipq
IF flipq < 1 THEN
PRINT "You must flip the coin at least 1 time"
END IF
DO WHILE count < flipq
LET num=INT(RND(0)*2)+1
IF num = 1 THEN
PRINT "T"
'LET count = count + 1
'LET tcount = tcount + 1
'LET maxtcount = tcount
'IF maxtcount > tcount THEN
'LET maxtcount = maxtcount
'END IF
ELSE
PRINT "H"
END IF
LOOP
PRINT tcount;
'PRINT "The maximum number of consecutive heads for " flipq; "coin flips is: " ;hcount
'PRINT "The maximum number of consecutive for " flipq; "coin flips is: " ;tcount