Program Won't Compile

This is a discussion on Program Won't Compile within the C++ Programming forums, part of the General Programming Boards category; Not sure why this won't compile. It says error on line 2 Code: // // program to convert temperature from ...

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    2

    Program Won't Compile

    Not sure why this won't compile. It says error on line 2
    Code:
    //
    // program to convert temperature from Celcius degree
    // units into Farenheit 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 Fehrenheit 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;
    }

  2. #2
    ZuK
    ZuK is online now
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by Stumped
    Not sure why this won't compile. It says error on line 2
    This is a joke isn't it ? ( my count is 9 )
    Code:
       using namespace std;
    Kurt

  3. #3
    Registered User
    Join Date
    Sep 2005
    Posts
    2
    Not a joke. Why. I don't know what I'm doing. It was what I was told to enter.

  4. #4
    ZuK
    ZuK is online now
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    If you put a semicolon after "using namespace std" the program compiles and runs ok. If your compiler tells you that this is line 2 throw it away.
    Kurt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Compile Public Domain Pocket PC C Program
    By m1l in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 07-20-2007, 04:02 AM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  4. new to C--can't get program to compile
    By samerune in forum C Programming
    Replies: 12
    Last Post: 04-02-2007, 09:44 AM
  5. how do i compile a program that deals w/classes?
    By Shy_girl_311 in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2001, 01:32 AM

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