View Single Post
Old 10-14-2007, 08:40 AM   #5 (permalink)
jay_bo
jay_bo's Avatar
 
Ultra Techie

Join Date: Jul 2006

Posts: 898

jay_bo is on a distinguished road

Default Re: What's wrong in this C++ code

///
/// Program to convert temperature from Celsius degree
/// units into Fahrenheit degree units:
/// Fahrenheit = Celsius * (212 - 32)/100 + 32
///
#include <iostream.h>
#include <conio.h>

int main(int nNumberofArgs, char* pszArgs[])
{
clrscr();
/// 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;

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

/// output the results
cout << "Fahrenheit value is:";
cout << fahrenheit;
getch();
return 0;
}


works for me in borland, i have done the fahrenheit program but i used varribles in mine like float, if you know what i mean
__________________
jay_bo is offline