Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
I want to write some statements as follows. Posted by blowSnow on 12 Dec 2004 at 3:00 AM
But this is illegal in pascal, what should be the correct syntax?

This is for the checking of my crossword,
I want to have something like that:
------------------------------------
score:=0;
if for x := 2 to 6 do
table[x,2] = answer[x,2] then
score:=score+1;
------------------------------------
urgent!could anyone help ?
ps.what i want to have in my program is to check the "whole" word first
then if the whole "word" is correct,score+1;
table[x,y] & answer[x,y] are char.
Report
Re: I want to write some statements as follows. Posted by zibadian on 12 Dec 2004 at 4:07 AM
: But this is illegal in pascal, what should be the correct syntax?
:
: This is for the checking of my crossword,
: I want to have something like that:
: ------------------------------------
: score:=0;
: if for x := 2 to 6 do
: table[x,2] = answer[x,2] then
: score:=score+1;
: ------------------------------------
: urgent!could anyone help ?
: ps.what i want to have in my program is to check the "whole" word first
: then if the whole "word" is correct,score+1;
: table[x,y] & answer[x,y] are char.
:
Only the word "if" is wrong in that piece of code. It should be:
  for x := 2 to 6 do
    if table[x,2] = answer[x,2] then
      score:=score+1;


Report
Re: I want to write some statements as follows. Posted by blowSnow on 12 Dec 2004 at 4:17 AM
: : But this is illegal in pascal, what should be the correct syntax?
: :
: : This is for the checking of my crossword,
: : I want to have something like that:
: : ------------------------------------
: : score:=0;
: : if for x := 2 to 6 do
: : table[x,2] = answer[x,2] then
: : score:=score+1;
: : ------------------------------------
: : urgent!could anyone help ?
: : ps.what i want to have in my program is to check the "whole" word first
: : then if the whole "word" is correct,score+1;
: : table[x,y] & answer[x,y] are char.
: :
: Only the word "if" is wrong in that piece of code. It should be:
:
:   for x := 2 to 6 do
:     if table[x,2] = answer[x,2] then
:       score:=score+1;
: 

:
:

This is not what i want, the score will be very large(every letters in each word is counted as one mark).
I just want 1 mark for a 'whole' word.Please help,urgent><
Report
Re: I want to write some statements as follows. Posted by zibadian on 12 Dec 2004 at 6:11 AM
: : : But this is illegal in pascal, what should be the correct syntax?
: : :
: : : This is for the checking of my crossword,
: : : I want to have something like that:
: : : ------------------------------------
: : : score:=0;
: : : if for x := 2 to 6 do
: : : table[x,2] = answer[x,2] then
: : : score:=score+1;
: : : ------------------------------------
: : : urgent!could anyone help ?
: : : ps.what i want to have in my program is to check the "whole" word first
: : : then if the whole "word" is correct,score+1;
: : : table[x,y] & answer[x,y] are char.
: : :
: : Only the word "if" is wrong in that piece of code. It should be:
: :
: :   for x := 2 to 6 do
: :     if table[x,2] = answer[x,2] then
: :       score:=score+1;
: : 

: :
: :
:
: This is not what i want, the score will be very large(every letters in each word is counted as one mark).
: I just want 1 mark for a 'whole' word.Please help,urgent><
:
Then here is the code to use:
  WordCorrect := true; { Assume the word is correct }
  for x := 2 to 6 do { Check the word }
    if table[x,2] <> answer[x,2] then { if an error is found }
      WordCorrect := false; { Word is wrong }
  if WordCorrect then
    score := score + 1; { Increase score for a correct word }


Report
Re: I want to write some statements as follows. Posted by blowSnow on 12 Dec 2004 at 6:18 AM
: : : : But this is illegal in pascal, what should be the correct syntax?
: : : :
: : : : This is for the checking of my crossword,
: : : : I want to have something like that:
: : : : ------------------------------------
: : : : score:=0;
: : : : if for x := 2 to 6 do
: : : : table[x,2] = answer[x,2] then
: : : : score:=score+1;
: : : : ------------------------------------
: : : : urgent!could anyone help ?
: : : : ps.what i want to have in my program is to check the "whole" word first
: : : : then if the whole "word" is correct,score+1;
: : : : table[x,y] & answer[x,y] are char.
: : : :
: : : Only the word "if" is wrong in that piece of code. It should be:
: : :
: : :   for x := 2 to 6 do
: : :     if table[x,2] = answer[x,2] then
: : :       score:=score+1;
: : : 

: : :
: : :
: :
: : This is not what i want, the score will be very large(every letters in each word is counted as one mark).
: : I just want 1 mark for a 'whole' word.Please help,urgent><
: :
: Then here is the code to use:
:
:   WordCorrect := true; { Assume the word is correct }
:   for x := 2 to 6 do { Check the word }
:     if table[x,2] <> answer[x,2] then { if an error is found }
:       WordCorrect := false; { Word is wrong }
:   if WordCorrect then
:     score := score + 1; { Increase score for a correct word }
: 

:
:
thanks



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.