Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Ayuda (https://www.clubdelphi.com/foros/showthread.php?t=66100)

Givanti 02-02-2010 07:11:24

Ayuda
 
Hola bueno en el colegio me pidieron hacer un programa que me pidiera valores y me de resultado eso creo ya esta bien , bueno tambien me pidieron que hciiera una parte donde me de el valor de 3 lados y me ponga que tipo d etraingulo es si equilatero , isoceles o escaleno , bueno es ahi donde tengo mi error espero me puedan ayudar anexo el codigo para ver si voy bien :

Código Delphi [-]

{$APPTYPE CONSOLE}
uses
  SysUtils;

var
 opc,tabla,x,respu,triangulo:integer;
   lado1,lado2,lado3:real;
   num1,num2,c,d,e,f,g,h,i,j:real;
 b:string;
begin
  { TODO -oUser -cConsole Main : Insert code here }
b:='si';
  while b= 'si' do
  begin
writeln('******CALCULOS*****');
writeln('*****1)TABLAS******');
writeln('******2)OPERACIONES BASICAS****');
writeln('*****3)TRIANGULOS*****');
writeln('*****QUE OPCION DESEAS***');
readln(opc);
if opc=1 then
begin
writeln('****TABLAS****');
writeln('QUE TABLA DESEAS CALCULAR----->');
readln(tabla);
for x:=1 to 10 do
begin
respu:=tabla*x;
writeln('=',respu);
end;
writeln('****DESEAS OTRA OPCION--->');
readln(b);
end;
if opc=2 then
begin
writeln('*****OPERACIONES BASICAS***');
writeln('DAME UN NUMERO--->');
readln(num1);
writeln('DAME OTRO NUMERO----->');
readln(num2);
c:=num1+num2;
writeln('LA SUMA ES--.>',c:2:2);
d:=num1-num2;
writeln('LA RESTA ES---->',d:2:2);
e:=num1*num2;
writeln('LA MULTIPLICACION ES---->',e:2:2);
f:=num1/num2;
writeln('LA DIVISION ES---->',f:2:2);
writeln('DESEAS OTRA OPCION---->');
readln(b);
end;
if opc=3 then
begin
writeln('*****TRIANGULOS****');
writeln('VALOR DE LADO1--->');
readln(lado1);
writeln('VALOR DE LADO2---->');
readln(lado2);
writeln('VALOR DE LADO3---->');
readln(lado3);
end;
if (lado1=lado2) and (lado2=lado3)  then
begin
writeln('**EL TIPO DE TRIANGULO ES EQUILATERO**');
end
if(lado1=lado2)and(lado2=lado3)or(lado1=lado3)then < --- aqui me sale missing operator semicolon

begin
writeln('***EL TIPO DE TRIANGULO ES ISOCELES***');
end
else
begin
writeln('****EL TIPO DE TRIANGULO ES ESCALENO***');
writeln('DESEAS OTRA OPCION---->');
readln(opc);
end;
end;
readln;
end.

Ñuño Martínez 02-02-2010 08:48:54

Hola Givanti.

Si te fijas, se te ha olvidado poner un "punto y coma" (semicolon en inglés) en la línea anterior. El resto del código parece estar bien, aunque sólo lo he leído por encima.

¡Y sé bienvenido al maravilloso mundo de la programación!:)

ElKurgan 02-02-2010 08:52:13

Código Delphi [-]
if (lado1=lado2) and (lado2=lado3)  then
begin
writeln('**EL TIPO DE TRIANGULO ES EQUILATERO**');
end  // Es que aqui te falta el punto y coma
if(lado1=lado2)and(lado2=lado3)or(lado1=lado3)then < --- aqui me sale missing operator semicolon

Saludos

Neftali [Germán.Estévez] 02-02-2010 11:22:03

Aparte de eso, yo añadiría allgun paréntesis más a esa línea, para clarificar la prioridad de las operaciones.

rafita 02-02-2010 14:39:07

Por la forma de poner los IF yo creo que le falta un ELSE,
y estoy de acuerdo con Neftali que debería utilizar algún paréntesis más, porque además de funcionar, también ha de ser fácilmente revisable.

Un saludo,

mamcx 02-02-2010 16:49:43

Tambien te recomiendo que mires http://www.clubdelphi.com/foros/guiaestilo.php, para facilitar el recibir ayuda en el futuro.

Es siempre mejor ser muy concreto en el titulo del hilo. "Ayuda" es muy abierto "Error de compilacion" todavia es muy abierto "Saca error 'missing operator semicolon'" y tienes un 10! ;)


La franja horaria es GMT +2. Ahora son las 19:35:55.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi