Pascal - Declare unknown amount of variables
I'm working with this excercise: make a program that gives the number of
consecutive letters of a word -ex: if i enter aaafdseergftth the program
returns a = 3, e=2, t=2-.
I've come up with a couple of solutions, like define a string and then use
an array to get the characters and compare then with a while loop, but
here's the issue: i can't use arrays, string, sunbfunctions to solve this
excersise, and explicitely says i have to look for another solution.
Now here is my second idea without using strings or arrays: Define an
unknown amounts of char variables and enter each one until Intro is
entered with a while loop like While not (Eoln) do (...). And that's the
only thing i can come up right now to solve it, but when i was looking for
a way to define an unknown amount of variables i found nothing but a
solution with an array that i should resize to enter new variables. How
can i define an unknown amount of variables without using arrays? -is it
even possible?-, and if can't be done, how could i get every character of
a word without using arrays nor strings?.
No comments:
Post a Comment