Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Program HW2;
type
HKID : record
firstChar : char;
sixInt : array[1..6] of integer;
veriStr : string;
end;
var
mang , ans: string;
sing : char;
sfz : HKID;
i : integer;
Begin
write('Enter your name : ');
readln(mang);
sing := '';
while ord(sing) <> (70 or 77 or 102 or 109) do
begin
write('Enter your sex : ');
readln(sing);
end;
write('Enter your HKID : ');
readln(sfz);
if (ord(mang[1]) < 65) and (ord(mang[i]) > 90) then
mang[1] := chr(ord(mang[1]) - 32);
for i := 2 to length(mang) do
begin
if ord(mang[i-1]) = 32 then
begin
if (ord(mang[i]) < 65) and (ord(mang[i]) > 90) then
mang[i] := chr(ord(mang[i]) - 32);
end;
else if (ord(mang[i-1]) > 65) and (ord(mang[i-1]) < 90) then
begin
if (ord(mang[i]) < 97) and (ord(mang[i]) > 122) then
mang[i] := chr(ord(mang[i]) + 32);
end;
end;
if (ord(sing) = 70) or (ord(sing) = 102) then
ans := 'Mr. ',mang
else
ans := 'Miss. ',mang
writeln(ans);
End.
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more