Code Room
Code reviewMedium
Question
Review this C++ loop that samples a signal at every 0.1s from 0 to a duration and counts the samples.
For `duration = 1.0`, the team expects 11 samples (0.0 .. 1.0).
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
int count = 0;for (double t = 0.0; t <= duration; t += 0.1) { sample(t); count++;}Run or narrate your approach, then ask the coach.