0
這是我的程序,沒有編譯信息,但在運行時它退出了,任何人都可以幫我嗎?什麼似乎是錯的? 這個問題是在我創建文件t後開始的,所以也許有些東西我看不到。提前致謝。 摺疊|複製代碼exitcode = 216在我的程序中沒有編譯信息
program MyProgr;
var
F: text;
t: Textfile;
a, count: array of Integer;
b: Integer;
i, int: Integer;
countnums: Integer;
n, m: String;
lin, nums: Integer;
Small, Big: Integer;
procedure DoWhatEver(S: string);
begin
val(S, int);
Write(S, ' ');
for i := Small to Big do
if (a[i] = int) then
count[i] := count[i] + 1;
end;
procedure FilltheArray;
begin
for i := Small to Big do
a[i] := i + 1;
end;
procedure ProcessString;
var
Strng, S: string;
Last, P: Integer;
begin
readln(F, Strng);
Last := 0;
while Last < length(Strng) do
begin
P := Last + 1;
while (P <= length(Strng)) and (Strng[P] <> ' ') do
inc(P);
S := copy(Strng, Last + 1, (P - Last - 1));
DoWhatEver(S);
Last := P;
end
end;
procedure ProcessStringA;
var
Strng: string;
Last, P: Integer;
begin
readln(F, Strng);
Last := 0;
while Last < length(Strng) do
begin
P := Last + 1;
while (P <= length(Strng)) and (Strng[P] <> ' ') do
inc(P);
n := copy(Strng, Last + 1, (P - Last - 1));
val(n, nums);
Last := P;
end
end;
procedure ProcessStringB;
var
Strng: string;
Last, P: Integer;
begin
readln(F, Strng);
Last := 0;
while Last < length(Strng) do
begin
P := Last + 1;
while (P <= length(Strng)) and (Strng[P] <> ' ') do
inc(P);
m := copy(Strng, Last + 1, (P - Last - 1));
val(m, lin);
Last := P;
end
end;
begin
assign(F, 'myfile.txt');
reset(F);
ProcessStringA;
Writeln(nums);
ProcessStringB;
Writeln(lin);
setlength(a, nums);
Small := Low(a);
Big := High(a);
for i := Small to Big do
count[i] := 0;
FilltheArray;
while not eof(F) do
ProcessString;
for i := Small to Big do
begin
if count[i] = 2 then
countnums := countnums + 1;
end;
Close(F);
assign(t, 'fileout.txt');
Rewrite(t);
Writeln(t, countnums);
Close(t);
end.
你改變了什麼「讓它創建文件」? –
我不得不打印結果,這意味着數字。在程序讀入的文本中出現少於一次的變量,所以我不能避免這樣做。它有什麼問題嗎? –
我們需要一個[最小,完整,可編譯示例](http://stackoverflow.com/help/mcve)。您的示例中的哪些行更改爲「使其創建文件」? –