Calendar Program Remove Modulus Help

How can I make this work without the modulus operator? Its for a calendar program...

1
2
3
4
5
6
7
8
9
10
11
  void printDays(int firstday, int day)
{
    for (int j = (1+firstday); j <= (day+firstday); j++)
    {
        cout << (j-firstday) <<"\t";
        
        if( j%7 == 0)
        {
            cout << endl;
        }
  
closed account (48T7M4Gy)
You can use integer division combined with a subtraction, or repeated subtraction in your very own module function.

You could also use a well designed if, eg if not between 0 and 7 inclusive then ..., in your design or even a while loop.
Topic archived. No new replies allowed.