M
M
Marat Akhmetshin2014-10-21 12:27:57
C++ / C#
Marat Akhmetshin, 2014-10-21 12:27:57

Why doesn't the program start in Dev-C++?

// 
//  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; 
}

I run the program in Dev-C++ v. 5.7.1, MinGW GCC4.8.1 compiler, 32-bit Release says that
File not compiled
.
I'm just starting to program. Help I don't understand :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Fedoryan, 2014-10-21
@AnnTHony

int fahrenheit;
fahrenheit = factor * celsius/100 + 32;

Degrees Fahrenheit is specified as an integer type. Try replacing with double.
When dividing, clearly fractional numbers are obtained.
upd.
#include <iostream>

using namespace std;

int main()
{
    int celsius;
    cout << "Enter the temperature in Celsius:";
    cin >> celsius;
    int factor;
    factor = 212 - 32;
    int fahrenheit;
    fahrenheit = factor * celsius/100 + 32;
    cout << "Fahrenheit value is:";
    cout << fahrenheit << endl;
    return 0;
}

Compiler GNU GCC, IDE Code::Block

A
AxisPod, 2014-10-22
@AxisPod

Is the compilation in progress? There is a feeling that nothing is compiled, since you are sitting under Windows, try Visual Studio C ++ Express for a start. And then pick Dev-C ++ and set it up correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question