I am so embarassed (),
I don't normally ask for help with my homework, but I just can't figure this one out..

this is the basic layout we are supposed to use:

Code:
   Sun     Mon     Tue     Wed     Thu     Fri     Sat
*********************************************************
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*********************************************************
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*********************************************************
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*********************************************************
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*********************************************************
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*       *       *       *       *       *       *       *
*********************************************************
we are supposed to ask for the number of days in a month, and the day in which the month starts..

then display it properly.


here is my code:
it all works fine, but I just can't figure out how to display the dates in the correct places...
I have tried so many different things, and I can't get it...

BTW, I am using Borland Turbo C++ 4.5, which has some non-ANSI functions, such as gotoxy, when goes to a point, and also clrscr, which clears the screen.



Code:
/*
Dennis Wrenn
12/8/00
Computer Science Period 6
e5-11
*/
#include <iostream.h>
#include <conio.h>
#include <inc.h>


void showcal(int numdays, int startday);
void dowords();

int main()
{
int numday, startday;
cout << "Enter the number of days in the month(30 or 31): ";
cin >> numday;
cout << "Enter the number for the day the month starts(1 = sunday, etc): ";
cin >> startday;

clrscr();

showcal(numday, startday);
return 0;
}

void showcal(int numdays, int startday)
{
	int i = 0;
	int odd = 0;

	dowords();

	for (i = 1; i <= 57; i += 8)
	{
		drawbar('v', i, 2, 21, '*');
	}

	for (i = 2; i <= 22; i +=4)
	{
		drawbar('h', 1, i, 57, '*');
	}

}


void dowords()
{
	gotoxy(4,1);
	cout << "Sun";

	gotoxy(12,1);
	cout << "Mon";

	gotoxy(20,1);
	cout << "Tue";

	gotoxy(28,1);
	cout << "Wed";

	gotoxy(36,1);
	cout << "Thu";

	gotoxy(44,1);
	cout << "Fri";

	gotoxy(52,1);
	cout << "Sat";
}
you may have seen a wierd header file in there..... inc.h
I wrote that so I didn't have to include my drawbar function in all the projects:

Code:
#include <conio.h>
void drawbar(char d, int l, char c)
{
int i = 0;
switch (d)
{
case 'v':
//verticle
for(i = 0; i < l; i++)
{
cout << c << "\n";
}
break;
case 'h':
//horizontal
default:
for(i = 0; i < l; i++)
{
cout << c;
}
break;
}
cout << endl;

}

void drawbar(char d, int x, int y, int l, char c)
{
int i = 0;
int y2 = y;
gotoxy(x,y);
switch (d)
{
case 'v':
//verticle
for(i = 0; i < l; i++)
{
gotoxy(x,y2);
y2++;
cout << c << "\n";
}
break;
case 'h':
//horizontal
default:
for(i = 0; i < l; i++)
{
cout << c;
}
break;
}
cout << endl;
}

I would like help on this soon, as it's bugging the crap out of me, but you can take your time, because I am way ahead of the class, and this is the 11th excersize in the book, and everybody else is still on #1...



Thanks a lot....

Dennis Wrenn