943,940 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4647
  • C++ RSS
Sep 9th, 2005
0

The Gregorian Calendar

Expand Post »
Hi, this is my first time here and I have a problem. I am trying to write a C++ program in Unix that gives me the Gregorian calendar with exceptions to leap year. I have all of my algorithms for calculating days, printing out the months, and such. My problem is that I need a loop in my int main function that loops the input in a way in which it would allow my days and day numbers to sync up and print them in columns and rows.....any suggestions??
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hmadison1984 is offline Offline
1 posts
since Sep 2005
Sep 9th, 2005
0

Re: The Gregorian Calendar

There's a number of ways to do this. What you're looking for is constant-width columns, correct? For the dates, this isn't too bad, because you just have to do a check based on if the value will be less than ten, and zero/space pad the value in formatting.

For the letters, though, things are a little harder.
Here's just one idea.
You could enumerate the days and months in an order based on the number of letters.
ie,
C++ Syntax (Toggle Plain Text)
  1. enum Month{MAY,JUNE,JULY,APRIL,MARCH}; //And so on...
and then use the value of the enumeration to set how many spaces you'll need to format the columns correctly with an if statement.
Reputation Points: 22
Solved Threads: 5
Posting Whiz in Training
Drowzee is offline Offline
244 posts
since Jul 2005
Sep 9th, 2005
0

Re: The Gregorian Calendar

Another problem will be the fonts used at your terminal. Every terminal may be using a different font set, so the spacing between colums will be diffeent. This app may be a good use for curses library, or use a good GUI library such as QT.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Jan 1st, 2010
-3

Gregorean Calander

Hi this is my first participation in this web, any how my problem is i was try to program the ff, but i am not succed, can u help me? the Q is According to the gregorean calander, it was monday on the date 01/01/1900. If any year input through the keyboard write a program to find out what is the day 0n 1st january of this year.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
KeraGofa is offline Offline
1 posts
since Jan 2010
Jan 1st, 2010
1
Re: The Gregorian Calendar
For first participation, you obviously ignored the request to read the forum rules, and completely ignored all the sticky posts at the top of the forum.

We can't help you with the information you gave.
Moderator
Reputation Points: 3278
Solved Threads: 894
Posting Sage
WaltP is offline Offline
7,739 posts
since May 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: CListCtrl sorting problem
Next Thread in C++ Forum Timeline: Disabling Keys





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC