Create 3 month calendar with (For Loop) in c++
<p>i want to create a 3 month calendar use c++ based on input start of month-day from user input with for loop;
so i wrote this codes : </p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

int main(int argc, char *argv[]) {
int i,d; 
cout&lt;&lt;"Enter Start Day : ";
cin&gt;&gt;d;
cout&lt;&lt;"\nSAT SUN MON TUE WED THU FRI\n";
for (i=1;i&lt;=d;i++) {
    if (d&gt;1)
    cout&lt;&lt;"   ";
    }
for (i=1;i&lt;=90;i++) {
    if(i&lt;10)
cout&lt;&lt;i&lt;&lt;"   ";
else 
cout&lt;&lt;i&lt;&lt;"  ";
if ((d-1+i)%7==0)
    cout&lt;&lt;"\n";
if (i%30==0 &amp;&amp; i&lt;90) {
    cout&lt;&lt;"\n\n";
    cout&lt;&lt;"SAT SUN MON TUE WED THU FRI\n";
}
}  
  return 0;
}
</code></pre>

<p>everything is ok,1st month is currectly created,but the problem is on 2nd and 3rd month.
i want to start new month from a day after previous Month ended with.</p>

<p>like that : </p>

<pre><code>SAT SUN MON TUE WED THU FRI
        27  28  29  30

**NEW MONTH**
SAT SUN MON TUE WED THU FRI
                         1
</code></pre>

<p>live code is here : <a href="http://codepad.org/iXbgy58m" rel="nofollow noreferrer">http://codepad.org/iXbgy58m</a></p>

<p>what i should to do.?</p>

<p>Thanks.</p>