回 帖 发 新 帖 刷新版面

主题:[原创]一个简单的温度转换程序,供大家参考。

一个简单的温度转换程序(用Dev-C++ 5写的),供大家参考。

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

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

  
  system("PAUSE");
  return 0;
}

回复列表 (共5个回复)

沙发

不是很清楚    ̄ ̄.....不清楚你写来干什么的..??

板凳

楼主的程序好象是错的,两个int型一除,结果就会取整!然后结果就总是差一点点!

3 楼

是吗?不过此程序运行正常,不会出现差错。

4 楼

请问这个程序的详细使用用途

5 楼

我也 不清楚这个东西存在的必要性 

我来回复

您尚未登录,请登录后再回复。点此登录或注册