안녕하세요 저는 3 자리 월 약자와 하루의 파일 입력을 읽는 작업이 주어졌으며 각각에 대한 율리우스 날짜를 계산해야합니다 (1 월 1 일 이후의 일 수) 두 개의 INTEGERS를 추가 할 때 상관없이 오류 201 (호환되지 않는 데이터 형식)이 발생합니다. 나는 새로운 프로그램을 만들려고 노력했지만 작동하도록 만들었지 만, 기존 코드에 구현하면 더 이상 작동하지 않습니다. 이것은 매우 실망 스럽습니다. 도와주세요. 나는이 어리석은 학급에 질려서 내가 온라인으로 똥을 찾을 수없는이 언어를 택하도록 돕는다.변수 파스칼에 const 문자열을 추가 할 때 런타임 오류 201
program prg6_150;
const
MONABV:array[1..12] of string[03] = ('JAN','FEB','MAR','APR','MAY','JUN',
'JUL','AUG','SEP','OCT','NOV','DEC');
MONDAYS:array[1..12] of integer = (31,28,31,30,31,30,31,31,30,31,30,31);
var
more_rec:Boolean; { EOF flag }
DAY:integer; { input day }
MONTH:string[03]; { input month abbreviation }
JULIAN:integer; { computed Julian day }
ch:char; { spacer character for input }
FileIn:Text;
FileOut:Text;
{ your module, to be called "JULIAN_DAY" inserted here }
procedure JULIAN_DAY;
var
j,sum_days:integer;
begin
j := 0;
sum_days := 0;
if MONTH = 'JAN' then j := 1 else
if MONTH = 'FEB' then j := 2 else
if MONTH = 'MAR' then j := 3 else
if MONTH = 'APR' then j := 4 else
if MONTH = 'MAY' then j := 5 else
if MONTH = 'JUN' then j := 6 else
if MONTH = 'JUL' then j := 7 else
if MONTH = 'AUG' then j := 8 else
if MONTH = 'SEP' then j := 9 else
if MONTH = 'OCT' then j := 10 else
if MONTH = 'NOV' then j := 11 else
if MONTH = 'DEC' then j := 12;
for J:= 2 to 12 do
repeat
sum_days := MONDAYS[1] + sum_days;
j := j - 1
until j = 1;
Julian := DAY + sum_days;
end;
procedure read_rec;
begin
if Eof(FileIn) then
more_rec := False
else
readln(FileIn,day,ch,month)
end; { read_rec }
procedure initialize;
begin
more_rec := True;
Assign(FileIn,'JULIAN.DAT');
Reset(FileIn);
Assign(FileOut,'JULIAN.OUT');
Rewrite(FileOut);
read_rec
end; { initialize }
procedure process;
begin
Julian_Day;
writeln(FileOut,day:2,' ',month,' ',julian:3);
read_rec
end; { process }
procedure wrapup;
begin
Close(FileOut);
Close(FileIn)
end; { wrapup }
begin { main }
initialize;
while more_rec do
process;
wrapup
end.
MONDAYS [1]은 보통 MONDAYS [j-1]입니다. 일시적으로 편집하려고 시도했지만 여전히 형식 오류 hurr durr을 보냈습니다. –