Board logo

標題: [疑難] 跪求大家 [打印本頁]

作者: 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);
                readln(FileV,P_name);
                readln(FileV,P_Ans);

           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

引用:
原帖由 HAHAKA 於 25-10-2008 20:29 發表
求求你地幫下我既cit coursework啦...
我個program..
唔識點read...下星期就要交..
我基本野做到最後先知read錯野
第1個file既fornat係
001
mary
CDBACBDDADABCABDACABAD
而個model ans既txt檔入面既form ...
又多一位應屆會考生... (我都係,交左功課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...

[ 本帖最後由 arararchchch 於 2008-10-25 21:33 編輯 ]
作者: 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

引用:
原帖由 HAHAKA 於 25-10-2008 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;
I see...

You are using parallel array...

Why not use array of record?? More easy...

What is variable t ?? Number of question??

if st_Ans[j][q] = AnsKey[q]

Here... I would use

if   upcase(st_Ans[j][q])  =    upcase(AnsKey[q])

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...

[ 本帖最後由 arararchchch 於 2008-10-25 22:08 編輯 ]
作者: HAHAKA    時間: 2008-10-25 22:14

你有冇msn之類?
我想sd個code比你幫我de下..
唔太多行
i 是no. of info
t是 no. of question

[ 本帖最後由 HAHAKA 於 2008-10-25 22:15 編輯 ]
作者: arararchchch    時間: 2008-10-25 22:24

引用:
原帖由 HAHAKA 於 25-10-2008 22:14 發表
你有冇msn之類?
我想sd個code比你幫我de下..
唔太多行
i 是no. of info
t是 no. of question


You Zip the files and upload as the attachment.

Files includes pascal source code, text files, etc..

I should see see..




歡迎光臨 香港 Xocat Forum 討論區 (http://p.xocat.com/p/) Powered by Discuz! 6.0.0