help a noob...

Discussion in 'Programming General' started by staples, Jan 12, 2008.

help a noob...
  1. Unread #1 - Jan 12, 2008 at 12:12 AM
  2. staples
    Referrals:
    0

    staples Guest

    help a noob...

    ya... i'm a complete noob to c++ (or any other language for that matter)
    One of my friends bought me c++ for dummies as a joke, but it ended up being helpful (well enough for me to get a fair start...).

    i got the compiler (dev-c++ v4.9.8.0 i think) i typed a whole [simple] code, clicked compile and it doesn't compile. Instead it goes to a new tab with a different code with a highlighted line etc. [i know don't know much about what i'm doing atm]

    plz help (will update with pics and stuff later, when i'm not in a hotel -.-)
     
  3. Unread #2 - Jan 12, 2008 at 3:07 AM
  4. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    help a noob...

    Post your exact code.

    When you get a compile error your description is what happens. You will generally get a highlighted line, with a listbox (or other) outlining your errors at some place in the window.

    A runtime error is something that is "correct" by the compiler checker, but is thrown due to bad programming logic. For example, a NullPointerException means that you are trying to use a null value (often caused by not assigning variables values, etc.) in place of something else (sorry about my bad description, but I have not studied in a long time, so I forgot how many things work).
     
  5. Unread #3 - Jan 14, 2008 at 12:31 AM
  6. staples
    Referrals:
    0

    staples Guest

    help a noob...

    ok im back at my house and heres my problems...

    conversion code... from celsius to fahrenheit


    Code:
     
    //
    //  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 celcius;
      cout << "Enter the temperature in Celsius:";
      cin >>> celsius;
      // calculate conversion factor for Celsius
      // to Fahrenheit
      int 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;
    }
    
    

    after i click compile>>>

    Code:
     
    // -*- 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'm fairly new to sythe so if i did something wrong plz let me know =/

    as you can see... i have no idea what im doing (learning)
     
  7. Unread #4 - Jan 15, 2008 at 9:31 AM
  8. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    help a noob...

    Here is the fixed working code, there were quite a few problems with yours so I almost completely re-worked it. Feel free to ask questions even though I'm no C++ guru.

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
      // Declare both of our variables as floating point
      double Celsius;
      double Fahrenheit;
      // Ask for user to input temperature in Celsius
      cout << "Enter the temperature in Celsius: ";
      // Get the temperature imput by the user
      cin >> Celsius;
      // Convert the user's temperature from Celsius to Fahrenheit
      Fahrenheit = 1.8 * Celsius + 32; 
      // Output the resulting temperature in Fahrenheit followed by a new line
      cout << "Fahrenheit value is: ";
      cout << Fahrenheit << endl;
      // Pause the program until the user is ready so he/she may view the result
      system("PAUSE");
      return 0;
    }
     
  9. Unread #5 - Jan 15, 2008 at 5:59 PM
  10. staples
    Referrals:
    0

    staples Guest

    help a noob...

    its not the script thats the problem, its the compiler...it goes to the second code i pasted after i click compile.

    i don't know what I'm doing... is there some settings i need to change before i can use it?
     
  11. Unread #6 - Jan 15, 2008 at 10:12 PM
  12. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    help a noob...

  13. Unread #7 - Jan 15, 2008 at 10:32 PM
  14. staples
    Referrals:
    0

    staples Guest

    help a noob...

    thanks ... now its working
     
  15. Unread #8 - Jan 16, 2008 at 7:28 AM
  16. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    help a noob...

    Which is why the Microsoft C(++) compiler /fails. ;)
    Bloodshed Dev-C++ is using the MinGW (minimalist GNU) set of compilers. They are conversions of the GNU C and C++ compilers, which are the compilers used by most programmers, noobs and professionals alike, on Linux. The beauty of Dev-C++ though, is you don't have to go through hell and high water to set it up, unlike say, Netbeans.

    I made a converter much like this a while ago - except it used loops to continually go through the program until the user typed in 0 (quit). If you wish me to rewrite it for you I'd be happy to oblige.
     
  17. Unread #9 - Jan 17, 2008 at 5:54 PM
  18. Saibot`
    Referrals:
    0

    Saibot` Guest

    help a noob...

    Get Visual C++ Express Edition
     
  19. Unread #10 - Jan 18, 2008 at 10:36 AM
  20. staples
    Referrals:
    0

    staples Guest

    help a noob...

    i got everything working... thanks
     
  21. Unread #11 - Jan 19, 2008 at 4:26 AM
  22. 8ed
    Joined:
    Dec 22, 2007
    Posts:
    192
    Referrals:
    0
    Sythe Gold:
    0

    8ed Active Member
    Banned

    help a noob...

    Kk :) Im glad to help
     
  23. Unread #12 - Jan 19, 2008 at 10:38 AM
  24. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    help a noob...

    Too lazy to read the topic properly... why exactly does MSVC fail? I've used it for all my projects and it's fine.
     
  25. Unread #13 - Jan 20, 2008 at 10:42 AM
  26. staples
    Referrals:
    0

    staples Guest

    help a noob...

    i honestly dont know why ppls are still posting on this thread...
     
< VB 2008 Help PleasE ?? | mouse functions & color checker & running in background >

Users viewing this thread
1 guest


 
 
Adblock breaks this site