help with my code

This is a discussion on help with my code within the C++ Programming forums, part of the General Programming Boards category; help me please with this code, why doesnt it work !!!! Code: #include <stdio.h> #include <iostream> #include <limits.h> int main(int ...

  1. #1
    looking for the truth moemen ahmed's Avatar
    Join Date
    Feb 2002
    Location
    Egypt
    Posts
    161

    why <limits.h> isnt working with me?

    help me please with this code, why doesnt it work !!!!

    Code:
    #include <stdio.h>
    #include <iostream>
    #include <limits.h>
    int main(int argc, char *argv[])
    {
      cout<< numeric_limits<float>::max()<<"\n";
      int a;
      cin>>a;
    
    
      return 0;
    }
    the compiler doesnt recognize ( the numeric_limits ) function
    thanks in advance
    Last edited by moemen ahmed; 02-11-2003 at 10:35 AM.
    Programming is a high logical enjoyable art for both programer and user !!

  2. #2
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    ...

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,803
    Using the correct limits/cstdio headers will help:
    Code:
    #include <iostream>
    #include <limits>
    #include <cstdio>
    using namespace std;
    
    int main(int argc, char *argv[])
    {
      cout << numeric_limits<float>::max() << endl;
      getchar();   // User needs to press a key to continue.
      return 0;
    }
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  4. #4
    looking for the truth moemen ahmed's Avatar
    Join Date
    Feb 2002
    Location
    Egypt
    Posts
    161
    thanks for your reply, but unfortuntally it doesnt work !
    Programming is a high logical enjoyable art for both programer and user !!

  5. #5
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Compiler errors on limits ???

    There is a good change your compiler is using the old Standard C++ library (which doesn't support limits).
    You will need to upgrade to a newer version.

    I have the same problem (using gcc v2.7).

  6. #6
    looking for the truth moemen ahmed's Avatar
    Join Date
    Feb 2002
    Location
    Egypt
    Posts
    161

    Talking

    thanks monster for your post , I realize you got the answer.
    I was trying this on DevC++ and it didnt work, but now its working on VC++6.0

    thanks .......
    and im sorry for the meaningless title of the thread, i will avoid such titles next times
    Programming is a high logical enjoyable art for both programer and user !!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 05:05 PM

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