Thread: Debugging driving me crazy

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ---
    Join Date
    May 2004
    Posts
    1,379

    Debugging driving me crazy

    This section of code just doesn't seem to work for me. It skips the if block (in bold) when I know the statement is true.

    Code:
    double convert_to_julian(int *p_year, int *p_mon, int *p_day){
      int a = 0, b = 0, c = 0, d = 0;
    
      if(*p_mon == 1 || *p_mon == 2){
        *p_year -= 1;
        *p_mon += 12;
      }
       // At this point I know that year is 1994 month is 2 and day is 1
      if((*p_year >= 1582) && (*p_mon >= OCT) && (*p_day >= 15)){
        a = (*p_year / 100);
        b = (2 - a) + (a / 4);
      }
      else{
        b = 0;
      }
    
      .
      .
      .
    But it does work if I remove the (*p_day >= 15) condition.
    There must be something I'm forgetting



    [edit]
    omg I just realised my problem. sorry for wasting time.
    the answer was this
    Code:
    if((*p_year > 1582) || (*p_year == 1582) && (*p_mon >= OCT) && (*p_day >= 15)){
    Last edited by sand_man; 07-06-2005 at 06:52 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. This program is driving my crazy!
    By zyphirr in forum C Programming
    Replies: 8
    Last Post: 12-05-2008, 05:36 PM
  2. This is driving me crazy! 256 colors palette
    By manugarciac in forum C++ Programming
    Replies: 0
    Last Post: 04-29-2007, 05:36 PM
  3. this is driving me crazy
    By pinko_liberal in forum C Programming
    Replies: 12
    Last Post: 06-05-2004, 08:03 AM
  4. Getline is driving me crazy
    By Vanished in forum C++ Programming
    Replies: 2
    Last Post: 01-23-2003, 12:27 AM
  5. IE 6 and Banner Ads is driving me crazy
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 01-09-2002, 02:18 AM