Strange bug with DevCPP v 4.9.9.2

This is a discussion on Strange bug with DevCPP v 4.9.9.2 within the C++ Programming forums, part of the General Programming Boards category; I have an odd bug with the new version of Dev CPP. I know this code is correct, as it ...

  1. #1
    Utter insanity
    Join Date
    Jan 2004
    Posts
    19

    Strange bug with DevCPP v 4.9.9.2

    I have an odd bug with the new version of Dev CPP. I know this code is correct, as it works fine and dandy on a prior version.

    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {
        int x;
        cout << "The size of an INT is:t\t\" << sizeof(int) << "bytes.n\";
        cout << "The size of a SHORT int is:t\" << sizeof(short) << "bytes.n\";
        cout << "The size of a LONG int is:t\" << sizeof(long) << "bytes.n\";
        cout << "The size of a CHAR is:t\t\" << sizeof(char) << "bytes.n\";
        cout << "The size of a FLOAT is:t\t\" << sizeof(float) << "bytes.n\";
        cout << "The size of a DOUBLE is:t\" << sizeof(double) << "bytes.n\";
        cout << "The size of a BOOL is:t\" << sizeof(bool) << "bytes.n\";
        cout << "press any key to continue...";
        cin >> x;
        return 0;
    }
    With the exception of the exit command that I've added, this is straight from the SAM's C++ in 21 days book. The compiler gives a missing terminating " on each line, a stray \ on each line, and says that a ; is missing from line 7. Adding a second " on each line, after the 't\"' of each statement changes the errors, but still doesn't work; and putting a space (which shouldn't even affect anything, if this was ANSI/ISO compatible) also changes the errors, seemingly randomly. It works fine on another computer with an older version of Dev CPP, so I am assuming it is a bug, probably with the sizeof command, since I haven't encountered it outherwise.
    "I merely took the energy it takes to pout and wrote some blues." - Duke Ellington

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    The slash comes before the symbol, not afterwards. It thinks that you're escaping the quote, instead of the "t" or "n". Try using "\t" and "\n".
    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

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,750
    > I know this code is correct, as it works fine and dandy on a prior version
    The fact that it compiles with "<insert name of compiler>" is rarely a sufficient test of correctness.

  4. #4
    Utter insanity
    Join Date
    Jan 2004
    Posts
    19
    Damn. I'm blind as a bat I guess. Thanks. I can't believe I did that
    "I merely took the energy it takes to pout and wrote some blues." - Duke Ellington

  5. #5
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    278
    Oh my god i am looking at the recent version of "EXHORCIST".
    Nothing can be spooky can this!!!!!!
    Glue ur eyes 2 these "\n" and "\t"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange bug with Input stream
    By Chazij in forum C++ Programming
    Replies: 12
    Last Post: 11-18-2008, 04:52 PM
  2. Strange bug....
    By beene in forum C++ Programming
    Replies: 4
    Last Post: 10-11-2006, 12:55 PM
  3. Strange Bug?
    By okinrus in forum C++ Programming
    Replies: 3
    Last Post: 07-07-2004, 02:00 PM
  4. Very strange bug...
    By JaWiB in forum Tech Board
    Replies: 6
    Last Post: 04-27-2003, 02:56 PM
  5. Very Strange Bug
    By Asm_Freak in forum C++ Programming
    Replies: 0
    Last Post: 02-09-2003, 11:04 PM

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