早教吧作业答案频道 -->其他-->
2^p高精度运算,数据测试1-4都可以,5就出错了ConstDateNum=1002^p高精度运算,数据测试1-4都可以,5就出错了ConstDateNum=100;TypeBinary=0..1;Num=0..9;VarDate:Array[1..DateNum]ofNum;i,j,Digit,Power:longint;ans0:Binary;
题目详情
2^p高精度运算,数据测试1-4都可以,5就出错了 Const Date_Num=100
2^p高精度运算,数据测试1-4都可以,5就出错了
Const Date_Num=100;
Type Binary=0..1;
Num=0..9;
Var Date:Array[1..Date_Num] of Num;
i,j,Digit,Power:longint;
ans_0:Binary;
Procedure Count_Digit;
Begin
For i:=Date_Num Downto 1 do
If Date[i]0 Then
Begin
Digit:=i;
Exit;
End;
End;
Procedure Double_Ans;
Begin
For i:=1 to Digit+1 do
If Date[i]*2-10+Ans_0>9 then
Begin
Date[i]:=Date[i]*2+Ans_0-10;
Ans_0:=1;
End
Else
Begin
Date[i]:=Date[i]*2+Ans_0;;
Ans_0:=0;
End;
End;
Begin
Writeln('Input the power you want to calculate(2^p=__.)');
Readln(Power);
Fillchar(Date,sizeof(Date),0);
Date[1]:=1;Digit:=1;
For j:=1 to Power do
Begin
Double_Ans;
Count_Digit;
End;
For i:=Digit Downto 1 do Write(Date[i]);
Readln;
End.
2^p高精度运算,数据测试1-4都可以,5就出错了
Const Date_Num=100;
Type Binary=0..1;
Num=0..9;
Var Date:Array[1..Date_Num] of Num;
i,j,Digit,Power:longint;
ans_0:Binary;
Procedure Count_Digit;
Begin
For i:=Date_Num Downto 1 do
If Date[i]0 Then
Begin
Digit:=i;
Exit;
End;
End;
Procedure Double_Ans;
Begin
For i:=1 to Digit+1 do
If Date[i]*2-10+Ans_0>9 then
Begin
Date[i]:=Date[i]*2+Ans_0-10;
Ans_0:=1;
End
Else
Begin
Date[i]:=Date[i]*2+Ans_0;;
Ans_0:=0;
End;
End;
Begin
Writeln('Input the power you want to calculate(2^p=__.)');
Readln(Power);
Fillchar(Date,sizeof(Date),0);
Date[1]:=1;Digit:=1;
For j:=1 to Power do
Begin
Double_Ans;
Count_Digit;
End;
For i:=Digit Downto 1 do Write(Date[i]);
Readln;
End.
▼优质解答
答案和解析
If Date[i]*2-10+Ans_0>9 then 这个判断条件有问题
要改成
If Date[i]*2+Ans_0>9 then
要改成
If Date[i]*2+Ans_0>9 then
看了2^p高精度运算,数据测试1-...的网友还看了以下:
探索规律,根据数据填空,并写出第N个数观察所给数字,按照规律填空,并写出第n个数.(1)1,3,5 2020-04-27 …
5×9=4555×9=495555×9=499555555×9=————555555×9=———— 2020-05-21 …
数据流图9-3中缺少了与“增加干部信息3.2”加工相关的数据流,请指出此数据流的方向,并采用说明中的 2020-05-26 …
科技改变生活,据5月9日央视《新闻直播间》报道,近日一法国设计师设计出“太阳能树”,它的外形与普通 2020-06-14 …
下面是某地12月份一周内的最低气温统计表.日期7日8日9日10日11日12日13日气温(°C)+4 2020-06-17 …
根据98×7=686写出下面各题的得数,根据98×7=686写出下面各题的得数,9.8×0.7=0 2020-07-09 …
根据“19×28=532”写出下面各题的积.1.9×28=1.9×2.8=1.9×0.28=1.9 2020-07-19 …
2^p高精度运算,数据测试1-4都可以,5就出错了ConstDateNum=1002^p高精度运算, 2020-10-29 …
据统计,1997年,我国工业制成品出口占出口总额的86.9%,同年,工业制成品出口占出口总额的世界平 2020-11-29 …
下图是一个运算器的示意图,A,B是输入的两个数据,C是输出的结果.右下表是输入A,B数据后,运算器输 2021-01-04 …