I want to write some statements as follows. - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

I want to write some statements as follows.

blowSnowblowSnow Posts: 9Member
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.

Comments

  • zibadianzibadian Posts: 6,349Member
    : 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:
    [code]
    for x := 2 to 6 do
    if table[x,2] = answer[x,2] then
    score:=score+1;
    [/code]

  • blowSnowblowSnow Posts: 9Member
    : : 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:
    : [code]
    : for x := 2 to 6 do
    : if table[x,2] = answer[x,2] then
    : score:=score+1;
    : [/code]
    :
    :

    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><
  • zibadianzibadian Posts: 6,349Member
    : : : 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:
    : : [code]
    : : for x := 2 to 6 do
    : : if table[x,2] = answer[x,2] then
    : : score:=score+1;
    : : [/code]
    : :
    : :
    :
    : 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:
    [code]
    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 }
    [/code]

  • blowSnowblowSnow Posts: 9Member
    : : : : 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:
    : : : [code]
    : : : for x := 2 to 6 do
    : : : if table[x,2] = answer[x,2] then
    : : : score:=score+1;
    : : : [/code]
    : : :
    : : :
    : :
    : : 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:
    : [code]
    : 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 }
    : [/code]
    :
    :
    thanks
Sign In or Register to comment.