c++ counting help

Hello, I have this assignment and for the life of me I cannot figure it out. well here it is

counting-controlled loops

write a program that displays the numbers 1 through 71. have 5 numbers to a line. use a constant called MAX that has the value 71. use a variable called count. which is initialized to 1 to control the loop.

use a loop that has the condition (count <=MAX)
inside of the loop, print the value of the count to the screen followed by a space
add an if statement inside of your loop. if count is evenly divisible by 5, put the cursor on the next time. this is how you will accomplish the requirement that the program print 5 numbers to a line. you will need to research a bit to find an operator that will do this for you.
What can't you figure out exactly?
the entire thing lol idk what operator to use and how to start it. once i start it or get a basic writing down i can figure the rest out
The operator you're looking for is the modulus operator (%), which gives you the remainder of divisions (example: 10%4 = 2). As for how to start it, you are given pretty specific instructions, a constant called MAX, a variable called count that holds integers, a loop and printing to console.
what would a sample look like? im just a little bit confused


an example of a counting program could look something like:
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

using namspace std;

int main()
{
    int count=0;
    while(count < 5)
        count++; // Short hand for count = count + 1
    cout << count << endl;
    return 0;
}
Topic archived. No new replies allowed.