hey guys, i just started my AS course of computing in school.
we've just started but i've been trying out different things, you know programs and whatever i could get out of it with my basic knowledge.
so i decided to try to make a program that will work out the length of a right angled triangle, using pythagras.
this program includes decisions and since we haven't done it in school i know very little.
for example, i will show you the code.
hopefull you will understand!
program caseexample;
program caseexample;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
choice : char;
choiceC, choiceB, choiceA, sideA, sideB, sideC : integer;
begin
writeln('Enter the length of A - if this is the length you are looking for then input 0 ');
readln(sideA);
writeln;
writeln('Enter the length of B - if this is the length you are looking for then input 0 ');
readln(sideB);
writeln;
writeln('Enter the length of C - if this is the length you are looking for then input 0 ');
readln(sideC);
writeln;
writeln('Choose the side of the triangle you want to find out the length of');
writeln;
writeln(' /|');
writeln(' / |');
writeln(' / |');
writeln(' C / | B');
writeln(' / |');
writeln(' / |');
writeln(' / |');
writeln(' /_ _ _ _|');
writeln;
writeln(' A');
writeln;
writeln;
writeln('A. I want to find out length A');
writeln('B. I want to find out length B');
writeln('C. I want to find out length C');
writeln;
writeln;
writeln('Enter a choice A , B or C');
writeln;
readln(choice);
writeln;
case choice of
'A' : SQRT((sideC * sideC) - (sideB * sideB));
'B' : SQRT((sideC * sideC) - (sideA * sideA));
'C' : SQRT(sideA * sideA + sideB * sideB);
else
writeln('Invalid choice!');
readln;
end;
end.
basically the SQRT values will not display, kidnd of ruining the whole pourpose.
putting readln; does not work as it is highlighted as error!
using Delphi XE trail version
thanks for help