Question:
I am to write a comparison program that outputs true mathematical statements. Ask the user for two numbers, and then output one of the following statements
number1>number2
number1<number2
or number1=number2
The user must also be able to keep running the program with different numbers, when they have finished running the program, thank them and tell them how many times they ran the program.
MY answer:
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
a, b: integer;
answer : char;
count : integer;
begin
for count:=1 to 3 do
answer:='y';
while answer = 'y' do
begin
Writeln ('Please enter a number.');
Readln(a);
Writeln ('Please enter another number.');
Readln(b);
if a>b then begin
writeln (a,' is greater than ', b);
end
else
begin
if a=b then
begin
writeln (a,' is equal to ', b);
end
else
if b>a then
begin
writeln (b,' is greater than ', a);
end;
end;
writeln ('Would you like to run this program again?');
readln (answer);
end;
writeln ('Thank you for your running this program.');
end.
But I am sure that my answer has some missing: thank them and tell them how many times they ran the program.
Please help me how to make changes.
Cheers,