10 20 30 P 40 50 S 10 30 P 34 50 P 10 10 S 45 60 double results = 0; peek at the input and put the results in a character while the input hasn't failed if the character we peeked is a letter and the character is 's' or 'S' or if the character is a digit go call the series function and store the answer in a running total results = results + series( input ); else if the character we peeked is a letter and the character is 'P' or 'p' go call the parallel function and store the answer in a running total while( isspace( input.peek() ) ) input.get(); peek at the input and put the results in a character series peek at the input and put the results in a character while the input hasn't failed and the next input is not a letter read the next double do the series goodness while( isspace( input.peek() ) ) input.get(); peek at the input and put the results in a character return the answer I summed up