Thread: NOTICE: New contest (finally)

  1. #76
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Originally posted by ygfperson
    Not the first time I tried it. Decompression of a text file (after compression) got me garbage. I haven't tested it under windows, though.
    When you decompressed, did you select the compressed file as the input or output?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  2. #77
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Originally posted by ygfperson
    Probably by the next weekend, maybe sooner. It's a long time to grade a few entries, but I'm just making sure I don't underestimate and leave some people waiting.
    It's Saturday ygf...
    Away.

  3. #78
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    I'll have them up in a few hours.

    //edit: to save on suspense, Xsquared won.

  4. #79
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Woohoo!
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  5. #80
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    Congratulations, Xsquared! May the next contest (whenever that is) be more productive.

  6. #81
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    What compiler did you use it on where it didn't decompress?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  7. #82
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Dammit, I submitted an older version, with only two small differences.

    1) Line 348: added '= { 0 }' at the end.
    2) Line 442: changed 'int curOffset = 0' to 'int curOffset = 1 + in.tellg( )'

    Then it works. Dang.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  8. #83
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Here's the cpp file with those two changes:
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  9. #84
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    I'm sorry... mentally, I'm in tears with laughter... That's too bad. I'm not going to do anything tonight, but maybe tomorrow I'll refigure the scores.

    Well, you won, anyway. And it's not that slow, either. (Granted, it's no winzip, but it compressed a 493k exe file of your program under dev-cpp to 371k. winzip further compressed that to 226k. winzip by itself compressed the file to 141k.)

  10. #85
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    I really don't care if it gets re-evaluated. I just wanted to show that it does actually work both ways.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  11. #86
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    Im looking over this code - and the 13th line stumped me

    Code:
    #define for if( 0 ); else for
    What does this do / mean? Thanks! (Ill probably have many more questions as i go through this, sorry )
    Do not make direct eye contact with me.

  12. #87
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Microsoft Visual C++ deviates from the standard scope of for statements.

    Example:
    Code:
    for( int i = 0; i < 5; i++ ) cout<<i<<endl;
    for( int i = 0; i < 6; i++ ) cout<<i<<endl;
    This should compile fine on a standards-compliant compiler, but in MSVC, you get an error: redefinition of 'i'.

    The '#define for if( 0 ); else for' would make it look like this:
    Code:
    if( 0 ); else for( int i = 0; i < 5; i++ ) cout<<i<<endl;
    if( 0 ); else for( int i = 0; i < 6; i++ ) cout<<i<<endl;
    OR if I inserted the braces:
    Code:
    if( 0 ) 
    {
    }
    else
    {
        for( int i = 0; i < 5; i++ ) cout<<i<<endl;
    }
    if( 0 ) 
    {
    }
    else
    {
        for( int i = 0; i < 6; i++ ) cout<<i<<endl;
    }
    This contains the scope of 'i' to within the if statement, basically correcting the deviation.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  13. #88
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    OK, I get it =)

    Thanks .
    Do not make direct eye contact with me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. NOTICE: New contest (finally) bumped and closed
    By Griz803 in forum Contests Board
    Replies: 3
    Last Post: 06-14-2004, 02:34 PM
  2. NOTICE: New Compression Contest
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 07-01-2003, 07:22 PM
  3. Finally, a New Contest! November 13+
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 11-13-2002, 09:06 PM
  4. Finally, a New Contest! November 13+
    By ygfperson in forum C Programming
    Replies: 0
    Last Post: 11-13-2002, 09:06 PM