Turbo Pascal Help

From Wikiversity

Jump to: navigation, search

This page is dedicated to helping Turbo Pascal 7 or 3.1 (for Windows) Programmers. To post questions, just go into edit and post them. They will be answered.

Click on the link below to go to my page and edit and paste the questions there or edit and paste your questions here.

Drnoitall.hello 02:52, 20 March 2007 (UTC)Drnoitall.hello


Questions Here: i wrote this program for my programmin class and i cannot figure out why i keep receiving the same error message i get the error 4 duplicate identifier for the variable "triangle" which is a string.

program triangle;

uses crt;

const skip=' ';

var side1:integer; side2:integer; side3:integer; triangle:string;

begin

  clrscr;
  writeln('Enter first side: ');
  readln(side1);
  writeln('Enter second side: ');
  readln(side2);
  writeln('Enter longest side(if applicable): ');
  readln(side3);
  if (side1=side2) or (side2=side3) or (side1=side3) then
  triangle:='isosceles'
  else
      if (side1<>side2) and (side2<>side3) and (side3<>side1) then
      triangle:='scalene'
      else
          if (side1=side2) and (side2=side3) then
          triangle:='equilateral';
  writeln('The triangle is ',traingle);
  if (triangle='isosceles') and (sqr(side1)+sqr(side2)=sqr(side3)) then
  writeln('The triangle is also a right triangle.')
  else
      writeln('The triangle is not a right triangle.');
  if (triangle='scalene') and (sqr(side1)+sqr(side2)=sqr(side3)) then
  writeln('the triangle is also a right triangle.')
  else
      writeln('the triangle is not a right triangle.');
  readln;

end. (The preceding unsigned comment was added by 98.196.206.181 (talkcontribs) 22:19, 23 October 2007.)