• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

2 Dimensional Arrays / Loop problem....

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi im trying to make a simple calender, i'm having a little difficulty:



this is my output:


Please enter the year and month of your choice.

Your year please: 2006

Your month please: 2

these are ur days 28

-------------------------------
Feb.
_______________________________

Mon. 1 2 3 4 5 6 7
Tue. 7 8 9 10 11 12 13
Wed. 13 14 15 16 17 18 19
Thu. 19 20 21 22 23 24 25
Fri. 25 26 27 28 29 30 31
Sat. 31 32 33 34 35 36 37
Sun. 37 38 39 40 41 42 43



-How do i rearrange the days?
-How do i get the days arranged chronologically so they tally with the actual gregorian calendar?
-Why do i have more days in the month than were returned?

could it be that my loops are faulty?

I'd really appreciate some help, thanx!
[ June 13, 2006: Message edited by: Wolfgang Obi ]
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's look at your code, my comments start with ***



Basically the code above winds up doing this:

So you are printing 7 days 7 times, for a total of 49 days with 6 duplicates. I doubt this is what you wanted.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic