3 Replies - 543 Views - Last Post: 22 March 2010 - 04:25 PM Rate Topic: -----

#1 adzak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-March 10

Help with calendar program

Posted 22 March 2010 - 02:04 PM

I am having trouble with my calendar program. I'm new to programing and my calendar needs to have a user insert the month in words and come out for any month in 2010. I'm trying to get the code completed and my function to display the days in the month is:

int daysinMonth (int month)
{
	int days;
	
	switch (month){
		case 1: case 3: case 5: case 7: case 8: case 10: case 12: days = 31; break;
		case 4: case 6: case 9: case 11: days = 30; break;
		case 2: days = 28;
	}
	return days;
}



So you can see that I need help getting all the days out as well as having the string of the months entered go into the function. I can only get it to work for months entered a numbers.

This post has been edited by Martyn.Rae: 22 March 2010 - 02:10 PM
Reason for edit:: Added code tags.


Is This A Good Question/Topic? 0
  • +

Replies To: Help with calendar program

#2 Martyn.Rae  Icon User is offline

  • The programming dinosaur
  • member icon

Reputation: 538
  • View blog
  • Posts: 1,406
  • Joined: 22-August 09

Re: Help with calendar program

Posted 22 March 2010 - 02:14 PM

I think I have understood where you are going with this one. You will need to set your month strings up as an array of character pointers and then use the month provided as the parameter as an index into that array. Does that help you progress further?
Was This Post Helpful? 0
  • +
  • -

#3 adzak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-March 10

Re: Help with calendar program

Posted 22 March 2010 - 02:42 PM

it helps to have the path I need to be on getting there is another story. Like I said my skill level is very low.
Was This Post Helpful? 0
  • +
  • -

#4 adzak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-March 10

Re: Help with calendar program

Posted 22 March 2010 - 04:25 PM

I've been working on getting the array but it only gives a large interger.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1