高分求C溫度轉換問題

時間 2022-07-09 19:10:06

1樓:北川怨魂

class temperature

set}///

/// 將攝氏溫度轉換為華氏

////// 要轉換的攝氏溫度

///public double tofahrenheit()}這個是寫在temperature類裡的內容要呼叫的時候:

temperature tem = new temperature();

tem.celsius = 18;//要轉換的溫度是多少textbox1.text = tem.tofahrenheit().tostring();//你要把結果輸出到**

2樓:佬的啊我沙溝曾

這裡是建立乙個控制台應用程式

//主函式

using system;

using system.collections.generic;

using system.linq;

using system.text;

namespace temperaturetransfer

while (cki.key != consolekey.enter);//按enter退出

temperature tp = new temperature();

tp.celsius = double.parse(result.substring(0, result.length - 1));

double fahrenheit=tp.tofahrenheit();

console.write("\nit's fahrenheit is: " + fahrenheit.tostring());

console.read();}}

}//temperature類

using system;

using system.collections.generic;

using system.linq;

using system.text;

namespace temperaturetransfer

set}public double tofahrenheit()}}

3樓:匿名使用者

不需要吧,其實也就數值方面的加減,以及你那個溫度換算公式,這樣就能坐出數值,然後在輸出的時候加上單位就可以啦

C中顯示轉換問題

convert.toint32 int 和int.parse三者的區別 前者適合將object類型別轉換成int型別,如convert.toint32 session shuzi int 適合簡單資料型別之間的轉換 int.parse適合將string類型別轉換成int型別,如int.parse s...

C語言,指標轉換問題

記憶體對齊的緣故。p buf 作為乙個指標,它的值是記憶體的某個位元組的位址。如果想要把 p buf 強制轉換成乙個 unsigned int 型別的指標,需要滿足乙個必要條件,就是 p buf 的值必須能夠被4整除。之所以是4,是因為 unsigned int 是要佔4個位元組的 所以你的做法會崩...

C 菜鳥問題!高分

標頭檔案錯誤 寫成 include 可以 也可以 include using namespace std 現在一般都是用後者,如果你以後用到stl你就會發現差別了 include stdafx.h 把這個標頭檔案去掉就可以了 我的也是vc6.0 提示的是不能開啟檔案stdafx.h 這個程式中也不用...