求助~~~在pascal里,乘方怎样表示啊?
pascal吧
全部回复
仅看楼主
level 1
我试过e:= a ** b,可是出错了救命啊,比赛拉~~怕怕啊
2005年10月12日 13点10分 1
level 1
这样出错:error in expression
2005年10月12日 14点10分 2
level 1
是用哪个compiler?** 这个operator要fp才支援
2005年10月12日 17点10分 3
level 1
噢! 对不起, 是我弄错了uses math;begin writeln(power(2, 3))end.
2005年10月12日 17点10分 4
level 1
我不知道什么是compiler,我用TP,能告诉我吗?
2005年10月13日 05点10分 5
level 0
如2的5次方y=2^5 {‘^’符号Pascal里没有}ln(y)=ln(2^5) {取e的对数}ln(y)=5*ln(2)e^ln(y)=y=e^(5*ln(2))=EXP(5*ln(2))所以2的5次就是EXP(5*ln(2)) {EXP和ln函数在Pascal里有}数学好的应该看的懂!
2005年10月13日 09点10分 7
level 1
好像有乘方的函数的吧 去找找看!!~~~~~~~~~~~~~~~~
2005年10月13日 10点10分 8
level 0
没有的,只有我上面的方法
2005年10月13日 10点10分 9
level 1
用power(a,b),就是A的B次方
2005年10月13日 11点10分 10
level 1
楼上的,can you sure?
2005年10月13日 13点10分 11
level 1
多谢各位的支持,你们说的方法,我都会去试,有更好的方法,就继续顶...
2005年10月13日 14点10分 12
level 6
经过尝试如果使用Variants单元那么可以使用**作为乘方运算样例:uses Variants;begin writeln(3**5); writeln(5**6); writeln(4**10);end.
2005年10月15日 03点10分 14
level 1
X的Y次方:exp(y*ln(x))
2005年10月16日 04点10分 15
level 1
用函数码?
2005年10月16日 04点10分 16
level 5
15楼说得没错需要注意:如果是整型/长整的话,需要用Trunc(Exp(y*Ln(x)))求x^y
2005年10月16日 10点10分 17
level 1
大家还有其他方法吗?
2005年10月19日 05点10分 18
level 1
a*a就是了
2005年10月20日 00点10分 19
level 0
diu
2005年10月20日 02点10分 20
level 0
write(' Gender? (M/F) '); readln(t_chr); if (t_chr <> 'M') and (t_chr <> 'F') then writeln('Oops! Invalid gender. M or F only.'); until (t_chr = 'M') or (t_chr = 'F'); writeln(new_source, t_chr); repeat write(' Age? '); readln(t_str2); val(t_str2, t_int, t_int2); if (t_int2 <> 0) or (t_int < 10) or (t_int > 100) then writeln('Oops! Invalid age.'); until (t_int2 = 0) and (t_int >= 10) and (t_int < 100); writeln(new_source, t_int); repeat write(' Graduation year? '); readln(t_str2); val(t_str2, t_int, t_int2); if (t_int2 <> 0) or (t_int < 1950) or (t_int > 2010) then writeln('Oops! Invalid year.'); until (t_int2 = 0) and (t_int >= 1950) and (t_int <= 2010); writeln(new_source, t_int); repeat write(' How many family members is ', t_str, ' going to bring with? '); readln(t_str2);
2005年10月20日 02点10分 21
level 0
不是说竞赛语言改用FreePascal了吗?就用 ** 就可以表示乘方了
2005年10月20日 05点10分 22
1 2 尾页