Thread: limits.h problem!!

  1. #16
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by guitarist809
    Where can i get this "shiny new version?" (url)
    msdn.microsoft.com

    bookmark it. it has all the documentation for the C++ standard library and all the ms APIs (win32, mfc, atl, com, etc)

    If you can find the free visual studio from there, give up programming.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  2. #17
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> bookmark it.

    just don't bookmark the reference pages - microsoft is notorious for changing it's links.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #18
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Change this

    Code:
    #include <iostream>
    #include <fstream>
    #include <math.h>
    #include <time.h>
    #include <iomanip>
    #include <conio.h>
    #include <string>
    #include <cmath>
    #include <cstdlib>
    #include <stdlib.h>
    #include <limits.h>
    #include <limits>
    #include <stdio.h>
    #include <cctype>
    #include <ctype.h>
    #include <cstdlib>
    #include <windows.h>
    to

    Code:
    #include <iostream>
    #include <fstream>
    #include <iomanip>
    #include <string>
    #include <cstdlib>
    #include <windows.h>

    By the way, you tried to include <cstdlib> twice


    Also, your media manager doesn't allow for duplicate values, and will overwrite old values, but the user isn't told that!

    All you ever use the windows API for is to display your name. So egoistic! Just display your credits section in the console and get rid of the include.

    Additional credit: implement a "sort movies by ___" option


    By the way, have you ever thought of using vectors, maps or lists?
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  4. #19
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > Actually, this is my includes.h file (for my c++ class) It has every include file that I can possibly use
    While this seems a good idea in preventing things from being undefined, you will never learn where things are defined.

    It also needlessly increases compilation times.
    For example, on my system (excluding conio.h and windows.h), all those header files add up to a massive 800K of data before the compiler gets to the couple of K of source code you wrote. Adding windows.h will add another big chunk to that.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #20
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    In any case, your include.h file is also hugely redundant by itself!
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  6. #21
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155
    hmmm. oh well. I still dont' get why it worked in Dev C++, but now it doesn't work in a Professioal compiler.

    ~one of the many mysteries of microsoft~
    ~guitarist809~

  7. #22
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    I mentioned it earlier. Did you add the #define NOMINMAX?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM