this part works fine but the next part i am stuck on, this is what the
question asks,
it wants me to adapt the program so there are two inputs, the starting day and the number of days in the month, (0 is sunday, 1 is monday, etc.)
these two inputs are to be passed to the output function from main.
so basically it wants me to get the starting day in the month under the correct weekday.
if anyone has any ideas on how to do this i would really appreciate it. i have been trying to get it to work for hours.
here is what i have done.
#include "stdafx.h"
#include <iostream>
using namespace std;
#include <iomanip>
void output_month()
{
int i;
i=1;
int j;
cin>>j;
for (int i = 1; i <= j; i++)
{
cout<<setw(5)<<i;
if (i % 7 == 0)
{
cout << endl;
}
}
}
void main()
{
cout<<"Input an Integer";
cout<<endl;
output_month();//call
if i understood correctly what the program is supposed to do, i think that is what you want.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Input start: 3
Input number of days: 31
S M T W T F S
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
Input start: 0
Input number of days: 28
S M T W T F S
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