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??

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,

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.

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.

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.

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.

This article has been dead for over six months. Start a new discussion instead.