Doubt regarding C++ code in old textbooks

This is a discussion on Doubt regarding C++ code in old textbooks within the C++ Programming forums, part of the General Programming Boards category; I have this Practical C++ Programming book, and i think its from 1997, and there's a few code changes that ...

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    55

    Doubt regarding C++ code in old textbooks

    I have this Practical C++ Programming book, and i think its from 1997, and there's a few code changes that won't compile in most compilers:

    First of all, the headers still have the .h extension like #include<iostream.h>

    Namespaces are nonexistent as well as the C++ strings (I'm guessing these were added recently?) so cout and cin are usesd without the std::

    Other minor details too..

    BTW I find the C++ file I/O system very confusing compared to the simple C one..

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Quote Originally Posted by thefeedinghand View Post
    I have this Practical C++ Programming book, and i think its from 1997, and there's a few code changes that won't compile in most compilers:

    First of all, the headers still have the .h extension like #include<iostream.h>

    Namespaces are nonexistent as well as the C++ strings (I'm guessing these were added recently?) so cout and cin are usesd without the std::

    Other minor details too..

    BTW I find the C++ file I/O system very confusing compared to the simple C one..
    Scrap it; it's horribly outdated.
    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. #3
    Registered User
    Join Date
    Jul 2010
    Posts
    55
    wow really? :P , it's the "second" most recommended book in the site, according to the main page lol

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,651
    Maybe you'd like to try the SECOND edition, published in 2002? The first was from 1995.

  5. #5
    Registered User
    Join Date
    Jul 2010
    Posts
    55
    oh sorry, didn't know there was a second edition :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code Doubt?
    By shwetha_siddu in forum C Programming
    Replies: 1
    Last Post: 07-21-2008, 01:02 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  3. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 04:39 PM
  4. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

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