我无法阅读以更改条件
program CFS;
{Defining Constants}
const
{Pay Rates}
ManagerBasic = 8000;
AssistManagerBasic = 7000;
SupervisorBasic = 5000;
SalesStaffBasic = 3000;
{Allowances}
DailyAllowance = 0.11;
TravelAllowance = 0.06;
EntertainmentAllowance = 0.035;
CommissionRate = 0.03;
{Deductions}
SocialSecurity = 0.06;
EnvironmentLevy = 0.01;
Insurance = 0.02;
{creating and initialising variables where necessary}
var
Name : string;
//i : integer = 0;
StaffType : string;
TotalSales : real = 0.0;
CommissionEarned : real = 0.0;
MajorLoop : integer = 1;
begin
{this is just the psueudocode comments for the real program}
writeln('The Caribbean Fashion Store');
writeln('Electronic Communication Calculator Version 1.0.1');
writeln('Build No. 001');
writeln('Sands, Sheba');
{We will use a while loop as a means of making the program start and stop at the user s will. First we ask for a choice:'}
writeln();
writeln('To process an employee, type 1 and press Enter, otherwise type 0 and press Enter');
while (MajorLoop = 0) do
begin
writeln('To process another employee, type 1 and press Enter, otherwise type 0 and press Enter');
end;
writeln(ManagerBasic/DailyAllowance);
{read is placed to stop the program}
readln();
end.
答案 0 :(得分:0)
在var部分中,您将MajorLoop初始化为值1,因此循环将永远不会运行。
将您的while
更改为
while(MajorLoop = 1) do
begin
writeln('To process another employee, type 1 and press Enter, otherwise type 0 and press Enter');
readln(MajorLoop);
end;
这样,如果用户键入0,则循环结束(我假设这就是您要执行的操作)。