pascal :got "boolean" expected "longint"
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/16 17:20:59
pascal :got "boolean" expected "longint"
var n,p,q,i,k,j:longint;t2:boolean; t1:boolean ;
begin
readln(n);
p:=1;
repeat
p:=p+1;
q:=n-p;
t1:=true;
for i:=2 to trunc(sqrt(p)) do
if p mod j=0 then begin t1:=false; k:=k+1;end;
t2:=true;
for i:=2 to trunc(sqrt(q)) do
if q mod j=0 then t2:=false;
until t1 and t2 and k=n;
writeln(n,':=',p,'+',q);
end.
var n,p,q,i,k,j:longint;t2:boolean; t1:boolean ;
begin
readln(n);
p:=1;
repeat
p:=p+1;
q:=n-p;
t1:=true;
for i:=2 to trunc(sqrt(p)) do
if p mod j=0 then begin t1:=false; k:=k+1;end;
t2:=true;
for i:=2 to trunc(sqrt(q)) do
if q mod j=0 then t2:=false;
until t1 and t2 and k=n;
writeln(n,':=',p,'+',q);
end.
倒数第二行t1 and t2 and k=n 错了
改为 t1 and t2 and (k=n);
不然t2会和k比较,boolean 不能和int比较
改为 t1 and t2 and (k=n);
不然t2会和k比较,boolean 不能和int比较
pascal中的 Incompatible types:got "Double" expected "Smallint"
boolean是什么意思?
John got beaten in the game,__had been expected.
_____ was expected,she got the first place in the
1.He got there ----------(soon) than l had expected.
Boolean operation是什么意思
pascal pascal pascal!
____was expected,she got the first place in the CCTV English
英语求正解We got _________as we had expected .twice scores as man
英语翻译but the salary i got was much more then expected.i cried
( )The porter has got ___ tips than he expected.A.much B.man
Boolean a=(Boolean)session.getAttribute("a");怎么解释