Kodewick
Start learning →
Starter←→0 / 86

Five Steps

#078Starterwhile (steps < 5)3 min

A robot takes five steps and calls out each one, 1 to 5, one per line. The counting and the stopping are written already — only the calling out is missing.

Should show
1
2
3
4
5
main.cpp
#include <iostream>
using namespace std;

int main() {
    int steps = 0;
    while (steps < 5) {
        steps++;
        // your code here: show which step it is on now
    }
    return 0;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.