Multiple choice

Choose the correct way to indicate that a line in a C++ program is a comment line, that is, a line the will not be executed as an instruction___.

  1. begin the line with a # sign

  2. begin the line with double slashes (/ /)

  3. begin and end the line with double hyphens (-_-)

  4. indent the line

  5. None of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

C++ uses double forward slashes (//) to indicate single-line comments. Everything after // on that line is treated as a comment and ignored by the compiler. Multi-line comments use /* */ syntax.