I have got a question which come together with my answer but I found that it does not too match with the question. Can you help me to make it changes?

Question:

A letter of the alphabet is to be input from the keyboard, and a message output as to whether it is upper or lowercase. The user is allowed to repeatedly input letters if they wish. Data entry is terminated by a non-alphabetical character.

My answer:

program WhileDoDemo;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
        I: char;

begin
  while (I<> 'q') and (I<>'Q') Do
    begin
      write('Enter a value:');
        readln(I);
      end;
  writeln('Press Enter to exit program');
  readln{To keep the window from closing until you press Enter};
end{WhileDoDemo}.

May I need to change it? Can you give me some ideas?

I wrote a program that demonstrate your problem :)

{
Question:

A letter of the alphabet is to be input from the keyboard,
and a message output as to whether it is upper or lowercase.
The user is allowed to repeatedly input letters if they wish.
Data entry is terminated by a non-alphabetical character.
}
Program Characters;
Uses Crt;
Var User:Char;
    U:Array[0..25]Of Byte;{upcase letters}
    L:Array[0..25]Of Byte; {lowercase}
    i,j,k:Byte;

Begin
  for i:=0 To 25 Do U[i]:=i+65;
  for i:=0 To 25 Do L[i]:=i+97;
  Repeat
     ClrScr;
     Write('Give me the character: ');
     ReadLn(User); {catch the answer}
     j:=Ord(User); { to number}
     If (j>=65) And (j<=90) Then Begin  {analize j's range}
     For i:=0 To 25 Do   {search}
        Begin
           k:=0;
           If (j = U[i])Then
              Begin
                 k:=1;   {if target found then exit For loop}
                 Break;
              End;
        End;
     End   {if found nothing the above search then }
     Else              {searching the lower case characters}
     For i:=0 To 25 Do
        Begin
           k:=0;
           If (j = L[i])Then
              Begin
                 k:=2;
                 Break;
              End
        End;
    {if both of search found nothing then k:=0 is the result}
    {analize k}
    Case k of
       0:Begin
           WriteLn('Wrong Char program is exiting..');
           ReadLn;
           Halt;   {exit main program}
         End;
       1:WriteLn(User,' is uppercase!');
       2:WriteLn(User,' is lowercase...');
    End;
    ReadLn;
  Until Keypressed;
End.
{
-=Note by FlamingClaw=-
this is just an example,but working...
this program is exiting when wrong character is pressed 
like numbers or other ones
-=Created by FlamingClaw=-
-=2009.03.24=-
}

Could you tell me what is the meaning of 'Keypressed', is this an integer??

Cheers,

Could you tell me what is the meaning of 'Keypressed', is this an integer??
Cheers,

Keypressed is just a function that part of the crt unit.It is has two value like True or false if the user press any key from the keyboard then the Keypressed returns as True else False

Try it!

Program kp;
Uses Crt;
Begin
   Repeat
       Write('*');
   Until KeyPressed;
End.
{this will write little stars to the screen
 and stops when you press any key}

I am wondering I can use the other commands rather than 'Keypressed. It is because there is an error of undeclared identifer. Sorry about this.

I am wondering I can use the other commands rather than 'Keypressed. It is because there is an error of undeclared identifer. Sorry about this.

I'm interesting in that undeclared identifier.....What is the error code,write what you see the whole line of error message

Type of expression must be BOOLEAN

Type of expression must be BOOLEAN

What line was that?
By the way I always compile my program in two different compiler.First I'm using the Dev-Pascal on that nothing errors
Second I loaded my source in the Turbo Pascal7.0 same result...

At the second last line. Is this a software problem?? I am using a Delphi 6.0.

Ok I got it now....My codes are written in PASCAL
and you write delphi
There are a lot of similiar things,but two different language

Really? Do you know Delphi as well?

sorry I'm just programming in pascal (dev pascal):yawn:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.