Board index » delphi » arrays and for do statements

arrays and for do statements

How would i write a program using a single array to store 26 letters of the
alphabet inputted from the keyboard. Including for ..do loops which will
a. output all the values of the array
b. output the last 10 letters of the alphabet
c. output letters b to k inclusive

Could you include a simple explanation of arrays and loops?

Thankyou
Zpy

 

Re:arrays and for do statements


On 23 Apr 2000 17:57:00 GMT, zpy...@aol.com (Zpy316) wrote:

Quote
>How would i write a program using a single array to store 26 letters of the
>alphabet inputted from the keyboard. Including for ..do loops which will
>a. output all the values of the array
>b. output the last 10 letters of the alphabet
>c. output letters b to k inclusive

>Could you include a simple explanation of arrays and loops?

>Thankyou
>Zpy

Program KeyChars2Array;
{If you use CRT, you can use READKEY and avoid using enter. This
simple demo should get you started but you do press enter after each
char. If you have more than 1 statement after DO you need
'Begin..End;}

CONST maxChar = 10;

VAR
ChArray: Array[1..maxChar] of Char;
j:Byte;

Begin
     Writeln; Writeln; Writeln('Input ', maxChar, ' characters.');
     For j := 1 to maxChar Do Readln(ChArray[j]);

     Writeln; Writeln('You entered these chars:');
     For j := 1 to maxChar Do Write(ChArray[j]:2);   {spaces chars}
Writeln; Writeln('Press <Enter> ');  Readln;
End.

Re:arrays and for do statements


Quote
> How would i write a program using a single array to store 26 letters of the
> alphabet inputted from the keyboard. Including for ..do loops which will
> a. output all the values of the array
> b. output the last 10 letters of the alphabet
> c. output letters b to k inclusive

> Could you include a simple explanation of arrays and loops?

   A school assignment, eh?  Have you been attending lectures and doing
the prior exercises?  Apart from not making much sense, this looks like
some kind of assignment, but we see none of _your_ work here.
   You are new here, and you may have heard that the Internet is a great
place to post questions - and get all kinds of expert help.  Well, the
latter part is generally true, because it _is_ a wonderful place for
getting information and help.  However, these Newsgroups are _not_ places
to get complete program assignments given to you, and we respond to (and
respect) those who help themselves.  That is, if you were to post what
_you_ had done one this assignment, as well as where you were having
problems, you would receive plenty of that "help" you'd heard about.
   So, if you want to learn about Pascal, you should attend classes and
do the homework.  Then, if you have specific problems with something you
don't quite understand, your queries will be welcome and answered...

Other Threads