///////
//
// Student: Russell Lowke
//     T.F: Francis Crick
// Unit Five, pencil-and-paper - question 1 [worth 2pts],  7/16/2002
//
//  practical joker gives you an array full of Bool values for your birthday
//

#include <iostream>
#include <iomanip>

void findSequence (bool list[], int n)
{
	int firstTrueAt = -1;
	int lastTrueAt  = -1;
	int numOfTrues;
	
	for (int i = 0; i < n; i++) {
		if ( ! list[i] && firstTrueAt > 0 ) {	// look for end of 'true' stream
			lastTrueAt  = i - 1;
		}
		if ( list[i] && firstTrueAt == -1 ) {	// look for start of 'true' stream
			firstTrueAt = i;
		}
	}
	
	if (lastTrueAt == -1 && firstTrueAt > 0) {
		lastTrueAt = n-1;
	}
	
	numOfTrues = lastTrueAt - firstTrueAt + 1;
	
	cout << "first true at: " << firstTrueAt << endl;
	cout << " last true at: " << lastTrueAt  << endl;
	cout << "  total trues: " << numOfTrues  << endl;
}
