Menu

1st time user...

Randy
2008-09-03
2012-09-26
  • Randy

    Randy - 2008-09-03

    Ok, I don't know if this was a good idea or not, but I just bought C++ for dummies so I can get a head start on my Computer Science degree, and I am running into a few problems.

    The first code I am supposed to type goes something like this.

    //
    // Program to convert temperature from Celsius degree
    // units into Fahrenheit degree units:
    // Fahrenheit = Celsius * (212 - 32)/100 + 32
    //

    include <cstdio>

    include <cstdlib>

    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 factor;
    factor = 212 - 32;

    // use conversion factor to convert Celsius
    // into Fahrenheit values
    int fahrenheit;
    fahrenheit = factor * celsius/100 + 32;

    // output the results (followed by a NewLine)
    cout << "Fahrenheit value is:";
    cout << fahrenheit << endl;

    // wait until user is ready before terminating program
    // to allow the user to see the program results
    system("PAUSE");
    return 0;
    }

    Now, the book tells me to save it and hit compile, I do that, and it opens up another tab that has this...

    // -- C++ -- forwarding header.

    // Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
    //
    // This file is part of the GNU ISO C++ Library. This library is free
    // software; you can redistribute it and/or modify it under the
    // terms of the GNU General Public License as published by the
    // Free Software Foundation; either version 2, or (at your option)
    // any later version.

    // This library is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    // GNU General Public License for more details.

    // You should have received a copy of the GNU General Public License along
    // with this library; see the file COPYING. If not, write to the Free
    // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    // USA.

    // As a special exception, you may use this file as part of a free software
    // library without restriction. Specifically, if other files instantiate
    // templates or use macros or inline functions from this file, or you compile
    // this file and link it with other files to produce an executable, this
    // file does not by itself cause the resulting executable to be covered by
    // the GNU General Public License. This exception does not however
    // invalidate any other reasons why the executable file might be covered by
    // the GNU General Public License.

    //
    // ISO C++ 14882: 18.1 Types
    //

    / @file cstddef
    * This is a Standard C++ Library file. You should @c #include this file
    * in your programs, rather than any of the "
    .h" implementation files.

    * This is the C++ version of the Standard C Library header @c stddef.h,
    * and its contents are (mostly) the same as that header, but are all
    * contained in the namespace @c std.
    */

    ifndef _CPP_CSTDDEF

    define _CPP_CSTDDEF 1

    pragma GCC system_header

    include <stddef.h>

    namespace std
    {
    using ::ptrdiff_t;
    using ::size_t;
    }

    endif

    I honestly don't know what any of this means right now, and according to the book all should be smooth sailing. I downloaded Dev C++4, but then uninstalled it when i realized that the book came with Dev C++ 5 beta. I would really appreciate it if someone could help me out with this, I am beating my head against the keyboard as we speak.

     
    • Randy

      Randy - 2008-09-04

      Thanks Clifford, I figured it out with the help of the other thread "PLEASE READ BEFORE POSTING A QUESTION. Turned out i didn't delete the devcpp.ini and devcpp.cfg files. I uninstalled Dev-C++ (version 4.9.8.0 from the C++ for dummies CD), then downloaded the latest version from www.bloodshed.net, just incase there was a bug on the CD. I typed up the program from the C++ for Dummies book and it ran perfect.

       
    • cpns

      cpns - 2008-09-03

      The tab that opens is the <cstddef> file (it should say that on the tab label); it is a standard library header file. Why it is opening I cannot say, you will have to tell us more precisely what you are doing (menu / toolbar sequence. etc.). It would normally only open if a compiler error were detected there, and you double clicked on the message in the "Compiler" windoww.

      Post the complete "Compile Log" tab text. Note that you are asked to do that as a matter of course in the "PLEASE READ BEFORE POSTING A QUESTION" thread.

      > Now, the book tells me to save it and hit compile

      Click it, or select it; but never hit it! ;-)

      > I downloaded Dev C++4, but then uninstalled it
      > when i realized that the book came with Dev C++ 5 beta.
      5 beta covers several versions, be precise. The current version is 4.9.9.2. It is displayed on the windows title bar and about box.

      Did you follow the instructions in "PLEASE READ BEFORE POSTING A QUESTION" for uninstalling the old version? All sorts of problems can occur if you don't. It is not as straightforward and running the uninstaller.

      If you are not running 4.9.9.2 then get it here http://downloads.sourceforge.net/dev-cpp/devcpp-4.9.9.2_setup.exe (or via the project download page from the forum menu).

      Clifford

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.