C > C++ (humorous)

This is a discussion on C > C++ (humorous) within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Code: #include <limits.h> #include <stdio.h> #include <iostream.h> int main() { int C = INT_MAX; int C_plus_plus = C + 1; ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    4

    C > C++ (humorous)

    Code:
    #include <limits.h>
    #include <stdio.h>
    #include <iostream.h>
    
    int main()
    {
      int C = INT_MAX;
      int C_plus_plus = C + 1;  // C_plus_plus is equivilent to C++
      if (C > C_plus_plus) {
        printf("C is greater!\n");
      } else {
        cout<<"C++ is greater!"<<endl;
      }
      return 0;
    }

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    dang, c is greater

  3. #3
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Yeah, C rules.

    I prefer printf to cout.

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    You have an error in your code.

    Code:
    #include <limits.h>
    #include <stdio.h>
    #include <iostream.h>
    
    int main()
    {
      int C = (INT_MAX-1);//much better
      int C_plus_plus = C + 1;  // C_plus_plus is equivilent to C++
      if (C > C_plus_plus) {
        printf("C is greater!\n");
      } else {
        cout<<"C++ is greater!"<<endl;
      }
      return 0;
    }

  5. #5
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Change it to this:

    Originally posted by LrdChaos
    Code:
    #include <limits.h>
    #include <stdio.h>
    #include <iostream.h>
    
    int main()
    {
      int C = INT_MAX;
      int C_plus_plus = C++;  // C_plus_plus is equivilent to C++
      if (C > C_plus_plus) {
        printf("C is greater!\n");
      } else {
        cout<<"C++ is greater!"<<endl;
      }
      return 0;
    }
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >You have an error in your code.
    Not an error, it's supposed to be that way I think. The most common result of overflowing a signed integer is to wrap around back to the highest negative number. Thus making C better than C++.

    Nice abuse of overflowing a signed integer, but the result won't be the same with everyone since the result of a signed integer overflow is undefined.

    -Prelude
    My best code is written with the delete key.

  7. #7
    Registered User compjinx's Avatar
    Join Date
    Aug 2001
    Posts
    214

    Hmmm...

    GASP! PROOF!
    "The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
    Eric Porterfield.

  8. #8
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Prelude, it was a joke. If he subtracted one away from INT_MAX, it would make C++ better than C.

  9. #9
    monotonously living Dissata's Avatar
    Join Date
    Aug 2001
    Posts
    341
    I think magos is the most creative. . .

    int c_plus_plus = c++;

    ooh that just made me laugh.
    if a contradiction was contradicted would that contradition contradict the origional crontradiction?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. small -> big -> bigger -> bigger than bigger -> ?
    By happyclown in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 03-11-2009, 12:12 PM
  2. Dev-C++ -> Tools - > Editor -> Syntax
    By Yuri2 in forum C++ Programming
    Replies: 19
    Last Post: 07-03-2006, 07:48 AM
  3. > > > Urgent Help < < <
    By CodeCypher in forum C Programming
    Replies: 2
    Last Post: 01-31-2006, 01:06 PM
  4. electricity > AC circuits > tesla coil
    By dbaryl in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 03-14-2002, 01:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21