38.6k views
5 votes
Assume that word is a variable of type string that has been assigned a value. Write an expression whose value is a string consisting of the first three characters of the value of word. So if the value of word were "dystopia" the expression's value would be "dys".

1 Answer

2 votes

Answer:

Step-by-step explanation:

The language I use would do it as

h1$ = copy(h$,1,3)

This may not satisfy you, because your language could be quite different. You might want an input statement of some kind that would define h$. This assumes that somewhere h,h1 are declared as strings.

You also have to know how to read an input. My language uses readln(input,h)

and how to write it on the screen write(h1) or writeln(h1)

User LolaRun
by
5.8k points