Question
execute the follwoing code in pascal with screen shot of answer begin if ch=0 then begin Label3.Caption:=Create directory USER1 '; CreateDir('C:USER1'); Button1.Caption:='Further > '; end;
execute the follwoing code in pascal with screen shot of answer
begin
if ch=0 then
begin
Label3.Caption:=Create directory USER1 ';
CreateDir('C:\USER1');
Button1.Caption:='Further > ';
end;
if ch=1 then
begin
Label3.Caption:=Create a text document '+ #13 +'file1.txt USER1'+ #13 +' enter text ...';
text:=InputBox
Assignfile (ftest,'C:\USER1\file1.txt');
rewrite(ftest);
begin
writeln(ftest,text);
Label1.Caption:= text;
end;
CloseFile(ftest);
end;
if ch=2 then
begin
Label3.Caption:='CreateDir USER2';
CreateDir('C:\USER2');
Button1.Caption:='Further >';
end;
if ch=3 then
begin
Label3.Caption:= Create a text document'+ #13 +'file2.txt USER2'+ #13 +' enter text ...';
text:=InputBox
Assignfile (ftest,'C:\USER2\file2.txt');
rewrite(ftest);
begin
writeln(ftest,text);
Label2.Caption:= text;
end;
CloseFile(ftest);
end;
if ch=4 then
begin
Label1.Caption:='';
Label2.Caption:='';
Label3.Caption:='
end;
if ch=5 then
begin
Assignfile (ftest,'C:\USER1\file1.txt');
reset(ftest);
readln(ftest,textf[1]);
CloseFile(ftest);
Assignfile (ftest,'C:\USER2\file2.txt');
reset(ftest);
readln(ftest,textf[2]);
CloseFile(ftest);
if textf[1]=textf[2] then
Label3.Caption:=They are different! ! ! '
else
begin
Label1.Caption:=textf[1];
Label2.Caption:=textf[2];
Label4.Caption:=They are the same ! ! ! ';
end;
end;
if ch=6 then
begin
Label4.Caption:='';
Label3.Caption:='CreateDir USER';
CreateDir('C:\USER');
end;
if ch=7 then
begin
Label3.Caption:='Copy file1.txt to USER ';
CopyFile('C:\USER1\file1.txt','C:\USER\file1.txt',true);
end;
if ch=8 then
begin
Label3.Caption:=' Copy file2.txt to USER ';
CopyFile('C:\USER2\file2.txt','C:\USER\file2.txt',true);
end;
if ch=9 then
begin
Label3.Caption:=('Delete file1');
Label1.Caption:='';
DeleteFile('C:\USER1\file1.txt');
end;
if ch=10 then
begin
Label3.Caption:=' Delete file2';
Label2.Caption:='';
DeleteFile('C:\USER2\file2.txt');
end;
if ch=11 then
begin
Label3.Caption:=' Delete USER1';
RemoveDir('C:\User1\');
end;
if ch=12 then
begin
Label3.Caption:=' Delete USER2';
RemoveDir('C:\User2\');
end;
if ch=13 then
begin
Label3.Caption:='';
Label1.Font.Color:= clRed;
Label1.Caption:=
Label2.Caption:='';
Button1.Enabled:=false;
end;
end;
end.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started