Program Calculator;
Uses Crt;
Label 1;
Var Selection, YesNo : String;
Number, A, B, C, Number2, Total, InsideRoot, MinusB, TWOA, Answer1, Answer2 : Integer;
Begin
1:Clrscr;
Total :=0;
Number :=0;
Number2 :=0;
Clrscr;
Writeln('This is a more complicated calculator, please make a choice.');
Writeln('1. Addition');
Writeln('2. Subtraction');
Writeln('3. Multiplication');
Writeln('4. Division');
Writeln('5. Quadratic');
Writeln('6. Quit');
Write('Your Choice Please:');
Readln(Selection);
If Selection = '1' then
Begin
ClrScr;
Write('Number 1:');
Readln(Number);
ClrScr;
Write('Number 2:');
Readln(Number2);
Total := Number + Number2;
ClrScr;
Write('Your Total is: ', Total);
Readln;
Write('Press any key to continue..');
Readkey;
Goto 1;
End;
If Selection = '2' then
Begin
ClrScr;
Write('Number 1:');
Readln(Number);
ClrScr;
Write('Number 2:');
Readln(Number2);
ClrScr;
Total := Number - Number2;
Write('Your Total is: ', Total);
Readln;
Write('Press any key to continue..');
Readkey;
Goto 1;
End;
If Selection = '3' then
Begin
Clrscr;
Write('Number 1:');
Readln(Number);
Write('Number 2:');
Readln(Number2);
Total := Number * Number2;
Write('Your Total is: ', Total);
Readln;
Write('Press any key to continue..');
Readkey;
Goto 1;
End;
If Selection = '4' then
Begin
Clrscr;
Write('Number 1:');
Readln(Number);
Write('Number 2:');
Readln(Number2);
Total := Number DIV Number2;
Write('Your Total is: ', Total);
Readln;
Write('Press any key to continue..');
Readkey;
Goto 1;
End;
If Selection = '5' then
Begin
Clrscr;
Write('Now for this, ill need a b and c.');
Readln;
ClrScr;
Write('Please enter a:');
Readln(A);
Write('Please enter b:');
Readln(B);
Write('Please enter c:');
Readln(C);
MinusB := 0-B;
TWOA := 2*A;
InsideRoot := (B*B) - (4*A*C);
Answer1 := ((0-B) + (Sqrt(InsideRoot))) DIV TWOA;
Answer2 := ((0-B) - Sqrt(InsideRoot)) DIV TWOA;
Writeln('Your answer is: ', Answer1);
Write('Or: ', Answer2);
Readln;
End;
If Selection = '6' then
Begin
Clrscr;
Write('Press any key to quit.');
Readkey;
Halt
End;
End.
When i try to compile it says
Recompiling because of D:\Program Files\FreePascalCompiler\bin\i386-win32\Calculator.pas
Calculator.pas(97,21) Error: Incompatible types: got "Extended" expected "LongInt"
Calculator.pas(98,21) Error: Incompatible types: got "Extended" expected "LongInt"
Calculator.pas(110,4) Fatal: There were 2 errors compiling module, stopping
Calculator.pas(0) Fatal: Compilation aborted
And its not extended, its a Integer, i also dont know exactly what is incompatible.
(This program is a calculator and i was working on a system to work out Quadratic Equations to see if i could do it)
Another link to my code: http://pastebin.com/d29e8e48d