This is my first Pascal program, its shit but its a start. I have learned this much within 1 day of studying, pascal is fun :>
code:
I won't upload the program because its too simple lol, just showing how easy it is to learn. Working on the GUI next.
Hmu if you want the source for some reason.
code:
Code:
program calcattempt;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
var
num1:integer;
num2:integer;
P1:char;
Sel:string;
{$IFDEF WINDOWS}{$R calcattempt.rc}{$ENDIF}
begin
repeat
writeln('---------Mcalc-------------');
writeln(' Press <ENTER> To Continue');
writeln('---------------------------');
readln;
repeat
write('Please Select Your Operation, A = +, B = - , C = /, or D = *: ');
readln(P1);
writeln;
writeln('incorrect format');
until (P1 = 'A') or (P1 = 'a') or (P1 = 'B') or (P1 = 'b') or (P1 = 'C') or (P1 = 'c') or (P1 = 'D') or (P1 = 'd');
writeln('So you have picked ', P1);
writeln;
write('Please Enter your First Number: ');
readln(num1);
write('Now Your Second Number: ');
readln(num2);
writeln;
case P1 of
'D','d':begin
writeln('Your Calculation is: ', num1*num2);
end;
end;
case P1 of
'A','a':begin
writeln('Your Calculation is: ', num1+num2);
end;
end;
case P1 of
'B','b':begin
writeln('Your Calculation is: ', num1-num2);
end;
end;
case P1 of
'C','c':begin
writeln('Your Calculation is: ', num1/num2:0:2);
end;
end;
writeln;
write('Press "A" To Exit Or "B" To Continue: ');
readln(sel);
writeln;
writeln;
until (sel = 'A') or (sel = 'a');
end.
I won't upload the program because its too simple lol, just showing how easy it is to learn. Working on the GUI next.
Hmu if you want the source for some reason.