亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我想要讓X得到我輸入的值,請問我需要做什么改動嗎?

我想要讓X得到我輸入的值,請問我需要做什么改動嗎?

C# C
蝴蝶不菲 2022-05-30 22:18:53
#include "stdafx.h"#include "math.h"using namespace System;using System;double f(double x){x=(2-pow(double(2.7182818),x))/10;return (x);}int main(array<System::String ^> ^args){int n=1;double x;Console::WriteLine("公式為 : e^x+10*x-2");Console::WriteLine("迭代式為 : x'=(2-e^x)/10");do{Console::WriteLine("請輸入x(0~1) : ");x=Convert.ToDouble(Console::ReadLine());}while(x<0.0||x>1.0);while((f(x)-x)*(f(x)-x)>=0.0005*0.0005){x=f(x);n+=1;}Console::WriteLine("結果為 : ",x);Console::WriteLine("計算次數 : ",n);Console::ReadLine();Console::ReadLine();return 0;}我想要讓X得到我輸入的值 x=Convert.ToDouble(Console::ReadLine());這句應該改成什么?或者改動什么地方?
查看完整描述

1 回答

?
偶然的你

TA貢獻1841條經驗 獲得超3個贊

double x=double.Parse( Console.ReadLine().ToString());
Convert.ToDouble好像不是這么用的吧...

查看完整回答
反對 回復 2022-06-06
  • 1 回答
  • 0 關注
  • 169 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號