• Log in or sign up for an account here: https://www.sythe.org/login

help a noob...

  • Thread starter Thread starter staples
  • Start date Start date
S

staples

Guest
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 -.-)
 
Member of the Month Winner
Sythe's 10th Anniversary
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).
 
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)
 
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;
}
 
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?
 
Member of the Month Winner
Sythe's 10th Anniversary
thanks ... now its working
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.
 
Kk :) Im glad to help
 
Le Monkey
PHP Shit Show 2k26
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
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.
Too lazy to read the topic properly... why exactly does MSVC fail? I've used it for all my projects and it's fine.
 
Runescape Gamblingrunescape gambling
Back
Top