Section 17.4.1.2 of the C++ Standard

This is a discussion on Section 17.4.1.2 of the C++ Standard within the C++ Programming forums, part of the General Programming Boards category; hello, I am a "out-of-the-box" programmer, and I hope I don't sound like a retard asking this question. I recently ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    2

    Question Section 17.4.1.2 of the C++ Standard

    hello,
    I am a "out-of-the-box" programmer, and I hope I don't sound like a retard asking this question. I recently purchased "C++ for Dummies" and downloaded the most recent version of DJGPP. Everything installed correctly, and I tried the first program in the book. It's a simple Celsius to Fahrenheit conversion program.

    Code:
    //
    // Program to convert temperature from Celsius degree
    // units into Fahrenheit degree units:
    // Fahrenheit = Celsius * (212 - 32)/100 + 32
    //
    #include <stdio.h>
    #include <iostream.h>
    
    int main(int nNumberofArgs, char* pszArgs[])
    {
         // enter the temperature in Celsius
         int celsius;
         cout << "Enter the temperature in Celsius:";
         cin >> celsius;
    
         // calculate conversion factor for Celsius
         // to Fahrenheit
         int fahrenheit;
         factor = 212 - 32;
    
         // use conversion factor to convert Celsius
         // into Fahrenheit values
         int fahrenheit;
         fahrenheit = factor * celsius/100 + 32;
    
         // output the results
         cout << "Fahrenheit value is:";
         cout << fahrenheit;
    
         return 0;
    }
    When I try to compile with the Make function I get an error message like this.

    Code:
    Compiling; Conversion.cpp
    
    c:\djgpp\lang\cxx\3.22\backward\iostream.h(31) In file included 
    
    from c:\djgpp\lang\cxx\3.22\backward\iostream.h: 31,
    
    Coversion.cpp (7)                               from Coversion.c :7:
    
    c:\djgpp\lang\cxx\3.22\backward\backward_warning.h (32)  
    
    Error: 2: warning: # warning This file includes at least one  
    
    deprecated or antiquated header. Please consider using one of 
    
    the 32 headers found in section 17.4.1.2 of the C++ standard. 
    
    Examples include substituting the <X> header for the <X.h> 
    
    header for the C++ includes, or <sstream> instead of the 
    
    deprecated header <strstream.h>. To disable this warning use
    
    -Wno-deprecated
    I'm pretty sure I don't want to disable warnings in RHIDE, but I don't have a clue what to do from here. I can't return the book because the seal (and the spine) has been broke on the book. I've tried search engines, other message boards, e-mails, and no one seems to know how to help. I am really looking forward to tackling this language, and any help provided would be much appreciated.

    Thanx.

  2. #2
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179
    try including <iostream> instead of <iostream.h>
    Illusion and reality become impartiality and confidence.

  3. #3
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Do what the error says; rid of deprecated headers. Try this:
    Code:
    //
    // Program to convert temperature from Celsius degree
    // units into Fahrenheit degree units:
    // Fahrenheit = Celsius * (212 - 32)/100 + 32
    //
    #include <cstdio>
    #include <iostream>
    
    using namespace std;
    
    int main(int nNumberofArgs, char* pszArgs[])
    {
         // enter the temperature in Celsius
         int celsius;
         cout << "Enter the temperature in Celsius:";
         cin >> celsius;
    
         // calculate conversion factor for Celsius
         // to Fahrenheit
         int fahrenheit;
         factor = 212 - 32;
    
         // use conversion factor to convert Celsius
         // into Fahrenheit values
         int fahrenheit;
         fahrenheit = factor * celsius/100 + 32;
    
         // output the results
         cout << "Fahrenheit value is:";
         cout << fahrenheit;
    
         return 0;
    }

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2

    Angry

    Thanx for the help. Guess I'll try to find some up to date tutorials on the web.

  5. #5
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    KEEP YOUR BOOK.

    Now that you know how to use the new style headers, and to add "using namespace std", you should be able to compile and run most of the programs in the book. Most of the changes to C++ are additions and enhancements... most "old" programs still work.

    You can't have too many books. I haven't found a perfect (or complete) C++ book yet. If you are able to learn from the book, use it to learn from. If you end-up using another book as your primary learning tool, the "For Dummys" book will likely explain things in a different manner, and cover some different material.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Standard efficiency
    By Jorl17 in forum C Programming
    Replies: 3
    Last Post: 06-18-2009, 11:48 AM
  2. Bug in iterator comparison in C++ standard?
    By steev in forum C++ Programming
    Replies: 14
    Last Post: 07-12-2008, 12:02 AM
  3. Replies: 8
    Last Post: 03-08-2008, 07:50 PM
  4. Standard Library
    By Jhanoosh in forum C++ Programming
    Replies: 1
    Last Post: 11-30-2002, 12:23 PM
  5. arrays and standard deviation
    By bruceness in forum C Programming
    Replies: 1
    Last Post: 10-28-2002, 08:35 PM

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