Need some help

I am suppose to make a program to display a calendar after inputting what day the month starts on and how many days are in the month. However when I run it, it labels all the days "0" and does not stop making rows.
It is probably a simple error I am not seeing.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int DAY1, QDAYS, DAYNUM, COL;
    
    //Intro
    cout << "ONE MONTH CALENDAR" << endl;
    cout << "===================\n" << endl;
    cout << "Written by Randolph Gibson" << endl;
    cout << "Coded by Robert Hirsch\n" << endl;
    cout << "Select from the menu below the numeral indicating which day of the week\nshould appear as the first day of the month on your calendar.\n" << endl;
    cout << "FIRST DAY OF MONTH MENU\n" << endl;
    cout << "1. Sunday\n2. Monday\n3. Tuesday\n4. Wednesday\n5. Thursday\n6. Friday\n7. Saturday\n" << endl;
    
    //Do-while loop
    do
    {
               cout << "Numeral (1-7)\n- ";
               cin >> DAY1;
               
               
              } while ((DAY1 < 1) || (DAY1 > 7));
               


                     
    

    
    //Second Do-while LOOP
    
    do
    {
             cout << "How many days are in the month? (28-31)\n- ";
             cin >> QDAYS;
             
            } while (QDAYS < 28 || QDAYS > 31);
             
             

    system ("CLS");               
    cout << "+---------+---------+---------+---------+---------+---------+---------+" << endl;
    cout << "|   SUN   |   MON   |   TUE   |   WED   |   THU   |   FRI   |   SAT   |" << endl;
    cout << "+---------+---------+---------+---------+---------+---------+---------+" << endl;
    
    DAYNUM = 1;
    
    while (DAYNUM <= QDAYS)
    {
          COL = 1;
          
          while (COL <= 7)
          {
                  
                  cout << "|";
                  
                  if ((DAYNUM = 1 && COL < DAY1) || (DAYNUM > QDAYS))
                  {
                              cout << "         ";
                              }
                  else 
                  {
                       cout << setw(9) << DAYNUM;
                       }
                  COL = COL + 1;
                  }
                  cout << "|" << endl;
                  cout << "|         |         |         |         |         |         |         |" << endl;
                  cout << "+---------+---------+---------+---------+---------+---------+---------+" << endl;
                  }
                  
                  
    

    return 0;
}
               


Topic archived. No new replies allowed.