Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hey guys I need help with the following problem, and I have no idea how to do it

ID: 3624544 • Letter: H

Question

Hey guys I need help with the following problem, and I have no idea how to do it.

A run is a sequence of adjacent repeated values. Write a program that generates a sequence of 20 random die tosses and
that prints the die values, marking the runs by including them in parentheses, like this:

1 2 (5 5) 3 1 2 4 3 (2 2 2 2 ) 3 6 (5 5) 6 3


Use the following pseudocode:
Set a boolean variable in_run to false
For each valid index i in the vector
{
If in_run
{
If values[i] is different from the preceding value
{
Print )
in_run = false
}
}
Else
{
If values[i] is the same as the following value
{
Print (
in_run = true
}
}
Print values[i]
}
If in_run, print )

Thanks in advance

Explanation / Answer

http://pastebin.com/DjBwX8PV This only addresses the problem as an array. I'm not too clear on arrays and the time was running out.