You have a semicolon after the for loop which means the cout statement is not within the loop but outside the loop.