2016-02-12 59 views
0

我剛開始學習帕斯卡語言,這是一個新的論壇2.原諒我的錯誤,並告訴我如何繼續。我希望在Pascal語言的這個算法的末尾提供一些幫助來正確地寫出輸出,有人可以幫我解決這個問題嗎?我收到這條消息:37行(最後一行)出現Sitax錯誤,CPY沒有預期。馬達面料帕斯卡成本利潤

Program MotorsFabric ; 
var 
Production,        { Production of types of motors} 
CPM: array [1..12,1..2] of integer;  { Cost per mounth} 
Values: array [1..2,1..2] of integer;  { Cost and Profit of each motor } 
CPY: array [1..2] of integer;    { Cost per Year} 
I,J,K: integer;       { Auxs} 


Begin 
for I := 1 to 12 do 
    for J := 1 to 2 do      { read Production } 
      read(Production [I,J]); 

for I := 1 to 2 do 
    for J := 1 to 2 do      { read values } 
      read (Values [I,J]); 

for I := 1 to 12 do 
    for J := 1 to 2 do      { Costs and Profits per mounth} 
      begin 
      CPM [I,J] := CPM 
      [I,J] + Production [I,K] * Values[K,J] 
      end; 
    for J := 1 to 2 do 
      begin 
      CPY [J] := 0;     { Costs an Profits per Year } 
      for I := 1 to 12 do 
        CPY[J] := CPY[J] + CPM [I,J] 
      end; 
    for I := 1 to 12 do 
      begin        { Writing results } 
      for J := 1 to 2 do 
        write (CPM [I,J]:10); 
      writeLn 
      end; 
writeLn ('Cost per Year :' CPY[1], ' Profit per Year :', CPY[2]); 
End. 
+2

你以後忘了逗號 '每年費用:'。 – BitTickler

+0

如果錯誤確實只是一個錯字,考慮刪除這個問題,因爲它不可能對其他人有用。 – m69

回答

2

你缺少一個逗號:

writeLn ('Cost per Year :' CPY[1], ' Profit per Year :', CPY[2]); 
         ^
         ^

應該

writeLn ('Cost per Year :', CPY[1], ' Profit per Year :', CPY[2]); 
+0

非常感謝你。當你悲傷時,這只是一個錯字錯誤。出於某種原因,我沒有看到這一點。我會刪除這個問題。再次感謝 – Drope