Here's a solution that uses conditional statements, loops, and array indexing to sum the values of the elements in a vector that are lower than 26:
main.m285 chars21 lines
This code loops through the elements in the vector, checks if each element is lower than 26 with an if statement, and adds it to the sum variable if it is. The sum is then displayed at the end. Note that the length() function is used to determine the number of elements in the vector.
gistlibby LogSnag