can you help?
program JattLife;
uses crt;
var
names : array [1..50] of string;
ages : array [1..50] of integer;
food : array [1..50] of string;
choice,i : integer;
freecell : integer;
begin
while (true) do
clrscr();
writeln('Pick your choice : ');
writeln('1. Add user');
writeln('2. Delete user');
writeln('3. View all users');
readln(choice);
case choice of
1 :
freecell := -1;
for i := 1 to 50 do
if names[i] = '' then
freecell := i;
break;
end;
if (freecell = -1) then
writeln('Arrays is fulls')
else
writeln('Type a name :');
readln(names[freecell]);
if names[freecell] = 'Michael' then
writeln('Ulucky on your name');
writeln('Type age :');
readln(ages[freecell]);
if ages[freecell] > 99 then
writeln('Well done on getting to 100!');
writeln('Type food :');
readln(food[freecell]);
if (food[freecell] = 'Pickles') then
writeln('YOu won a prize!');
2 :
if (Names[i] = '') then
continue;
writeln('[',i,'] Name: ',Names[i],'; Age: ',Ages[i],'; Food: ',food[i],';');
writeln('Type deleting index: (1,2,3 etc)');
readln(freecell);
if (freecell > 0) AND (freecell < 51) then
Names[freecell] := ''
writeln('Incorrect index');
3 :
writeln('Type Any Key...');
end.
Copyright © 2024 QUIZLS.COM - All rights reserved.
Answers & Comments
Verified answer
program JattLife;
uses crt;
var
names : array [1..50] of string;
ages : array [1..50] of integer;
food : array [1..50] of string;
choice,i : integer;
freecell : integer;
begin
while (true) do
begin
clrscr();
writeln('Pick your choice : ');
writeln('1. Add user');
writeln('2. Delete user');
writeln('3. View all users');
readln(choice);
case choice of
1 :
begin
clrscr();
freecell := -1;
for i := 1 to 50 do
if names[i] = '' then
begin
freecell := i;
break;
end;
if (freecell = -1) then
writeln('Arrays is fulls')
else
begin
writeln('Type a name :');
readln(names[freecell]);
if names[freecell] = 'Michael' then
writeln('Ulucky on your name');
writeln('Type age :');
readln(ages[freecell]);
if ages[freecell] > 99 then
writeln('Well done on getting to 100!');
writeln('Type food :');
readln(food[freecell]);
if (food[freecell] = 'Pickles') then
writeln('YOu won a prize!');
end;
end;
2 :
begin
clrscr();
for i := 1 to 50 do
begin
if (Names[i] = '') then
continue;
writeln('[',i,'] Name: ',Names[i],'; Age: ',Ages[i],'; Food: ',food[i],';');
end;
writeln('Type deleting index: (1,2,3 etc)');
readln(freecell);
if (freecell > 0) AND (freecell < 51) then
Names[freecell] := ''
else
writeln('Incorrect index');
end;
3 :
begin
clrscr();
for i := 1 to 50 do
begin
if (Names[i] = '') then
continue;
writeln('[',i,'] Name: ',Names[i],'; Age: ',Ages[i],'; Food: ',food[i],';');
end;
writeln('Type Any Key...');
readln(freecell);
end;
end;
end;
end.