
Kathryn C. answered 09/28/21
Computer Science Graduate and Experienced Tutor/Instructor
Hi James!
Generally, as a beginner, if you are dealing with counting, you want to use a for a loop.
A good way to know when to use a while over a for is attempting to describe your thought process/solution using the words "while" vs "for". Oftentimes, it is incredibly hard to create a counting problem using the word "while".
while 7 times? no... that doesn't sound right.
for 7 times, output a number then a new line. makes more sense in English.
That being said, your cout does not need to be surrounded by curly braces. Think of curly braces as defining or relating scope. Curly braces here do not relate within the content to anything nor does it define a necessary need for a new scope. Hopefully, that helps.
Wish you luck on your journey of programming! You're on the right track.