I can not figure out, I need your hint. You can use only packed array. Variables of string type cannot be used. Those. use Pascal standard, not tubro, etc.

How can I count a word and assign it to a variable? The word length is unknown. I can not figure out the assignment mechanism.

  • @Magos, arrays then yes. But the text in the case and the packed array is not. In this, I slow down. - VladislavMSK

1 answer 1

read characters to the first space or punctuation

  • @Magos, I understood that myself. How do I write this into a variable and what type? - VladislavMSK
  • More precisely, what type of variable should it be? - VladislavMSK
  • type string = Packed Array [1..255] of Char; var pc : string; c:char; ... i:=1; read(f,c); if c = ' ' then pc[i]:=#0 else begin pc[i]:=c; i:=i+1; end; something like that - Magos
  • would be more beautiful to wrap in repeat ... until - Magos
  • @Magos, thought so too. BUT! I need to compare this later with text like 'Anna'. Comparison of packed ride is it? For clarity, I can completely give a condition. - VladislavMSK