预期但是。结果
当我更改我的代码以修复它时,它不会显示答案。无法看清我做错了什么。 (它是一个更大的程序的一部分,因此最后的程序段和程序)。如果您知道如何解决这个或更简单的方法来写出来,我会很感激。它需要保留一个功能。
user_path(id)
答案 0 :(得分:1)
如果是pascal代码,那么您的程序必须以:
开头program MyProgram;
并以:
结束end.
程序定义的一般形式如下:
procedure name(argument(s): type1, argument(s): type 2, ... );
< local declarations >
begin
< procedure body >
end;
因此,每个程序必须包含最后一个关键字:end;
在程序结束时temperature
是:end.
并且编译器说它期望;
但找到.
因为end.
必须仅在程序结束时但是不是程序。
答案 1 :(得分:0)
您的条件重复循环没有开头,也没有结束。如果有一段时间,if,repeat-until,try-else等在其中有多行代码,则必须使用开头和结尾。 (结束;不结束。)。
因此,格式正确,您的代码应为:
procedure temperature;
function Sum(var F,M:integer):integer;
var
c:integer;
begin
readln(F);{This line needs to be first to get F to use in the calculation. This program is all wrong. Read from what? You must define the file you are reading from - ReadLn(FileName,VariableToReadTo)}
M:=(F-32);{Make sure you are declaring these somewhere.}
C:=M*(5 div 9);
writeln('In Centigrade that is '+IntToStr(C));{Need to define file to WriteTo. You also must Append the file to write to it.}
writeln('Give me the temperature in Fahrenheit to convert to Centigrade.');{Need to define file to WriteTo. You also must Append the file to write to it.}
writeln(sum);{Need to define file to WriteTo - WriteLn(FileName, VariableToWrite). You also must Append the file to write to it.}
readln;{This line does not have any arguments. What is this supposed to do? Is your program finished?}
end;
procedure finished;{Empty procedure}
begin
end;
begin
initialise;
repeat
begin{Didn't have this. Need begin and end because of multiple lines.}
displaymenu(choice);
case choice of
1: throwdice;
2: heightweight;
3: textwords;
4: temperature;
0: finished;
end;
until choice=0;
readln;{What does this do??}
end.a{Characters outside of code end.}