HAHAKA 2008-10-25 20:29
跪求大家
求求你地幫下我既cit coursework啦...
我個program..
唔識點read...下星期就要交..
我基本野做到最後先知read錯野
第1個file既fornat係
001
mary
CDBACBDDADABCABDACABAD
而個model ans既txt檔入面既format係
C
D
B
A
C
B
D
D
A
D
A
B
C
A
B
D
A
C
A
B
A
D
...
我唔知點可以對番個答案
又同時間將分數match番人名同學校名
我應該點read?
我咩方法都試過了
我知你地係好人..
我cit一直都唔太好...但求呢個coursework合格.
求下你地/..
我係咁打既..
assign(FileV,FileName);
reset(FileV);
i := 0;
while not eof(FileV) do
begin
i := i + 1;
readln(FileV,sch_name[i]);
readln(FileV,P_name[i]);
readln(FileV,P_Ans[i]);
end;
assign(KeyFile,F2);
reset(KeyFile);
reset(FileV);
t := 0;
while not eof(KeyFile) do
begin
t := t + 1;
readln(KeyFile,AnsKey[t]);
read(FileVariable,P_ans[t]);
end;
close(KeyFile);
Close(FILEV);
我個學生名同學校名都SET左做STRING
而學生答案同MODEL ANSWER就SET左CHAR
全都用ARRAY
唔知有邊度READ錯呢...
arararchchch 2008-10-25 21:28
[quote]原帖由 [i]HAHAKA[/i] 於 25-10-2008 20:29 發表 [url=http://xocat.com/f/redirect.php?goto=findpost&pid=5491971&ptid=222320][img]http://xocat.com/f/images/common/back.gif[/img][/url]
求求你地幫下我既cit coursework啦...
我個program..
唔識點read...下星期就要交..
我基本野做到最後先知read錯野
第1個file既fornat係
001
mary
CDBACBDDADABCABDACABAD
而個model ans既txt檔入面既form ... [/quote]
又多一位應屆會考生... (我都係,交左功課la~~)
assign(FileV,FileName);
reset(FileV);
i := 0;
while not eof(FileV) do
begin
i := i + 1;
readln(FileV,sch_name[(i)]);
readln(FileV,P_name[(i)]);
readln(FileV,P_Ans[(i)]);
end;
assign(KeyFile,F2);
reset(KeyFile);
reset(FileV);
t := 0;
while not eof(KeyFile) do
begin
t := t + 1;
readln(KeyFile,AnsKey[t]);
read(FileVariable,P_ans[t]);
end;
close(KeyFile);
Close(FILEV);
I should have more info about your program...
[[i] 本帖最後由 arararchchch 於 2008-10-25 21:33 編輯 [/i]]
HAHAKA 2008-10-25 21:42
for j := 1 to i do
begin
corr := 0;
for q := 1 to t do
if st_Ans[j][q] = AnsKey[q]
then corr := corr + 1;
str(Corr,st_Mark[j]);
end;
之後將學生答案個行同model answer入面既答案比較
用呢舊野黎計出竟竟佢地o岩左幾題
但我知道肯定係read data個度有問題
arararchchch 2008-10-25 21:59
[quote]原帖由 [i]HAHAKA[/i] 於 25-10-2008 21:42 發表 [url=http://xocat.com/f/redirect.php?goto=findpost&pid=5492176&ptid=222320][img]http://xocat.com/f/images/common/back.gif[/img][/url]
for j := 1 to i do
begin
corr := 0;
for q := 1 to[color=red][b] t[/b][/color] do
[color=blue][b] if st_Ans[j][q] = AnsKey[q]
[/b][/color] then corr := corr + 1;
str(Corr,st_Mark[j]);
end;
[/quote]
I see...:loveliness:
You are using parallel array...
Why not use array of record?? More easy...
[color=red][b]What is variable t ?? Number of question??[/b][/color]
[color=#0000ff]if st_Ans[j][q] = AnsKey[q][/color]
Here... I would use
[color=#0000ff] if upcase(st_Ans[j][q]) = upcase(AnsKey[q])[/color]
[color=#0000ff][/color]
upcase is a function which turns alphabets(no matter small or capital letters) into capital
So, it ensures A = a , B = b , etc.
However, I cannot solve your problem because I don't have further info...
[[i] 本帖最後由 arararchchch 於 2008-10-25 22:08 編輯 [/i]]
HAHAKA 2008-10-25 22:14
你有冇msn之類?
我想sd個code比你幫我de下..
唔太多行
i 是no. of info
t是 no. of question
[[i] 本帖最後由 HAHAKA 於 2008-10-25 22:15 編輯 [/i]]
arararchchch 2008-10-25 22:24
[quote]原帖由 [i]HAHAKA[/i] 於 25-10-2008 22:14 發表 [url=http://xocat.com/f/redirect.php?goto=findpost&pid=5492323&ptid=222320][img]http://xocat.com/f/images/common/back.gif[/img][/url]
你有冇msn之類?
我想sd個code比你幫我de下..
唔太多行
i 是no. of info
t是 no. of question [/quote]
冇:oh:
You Zip the [color=red][b]files[/b][/color] and upload as the attachment.
Files includes pascal source code, text files, etc..
I should see see..