Board index » delphi » HELP!! Please help beginner w/ easy lab project

HELP!! Please help beginner w/ easy lab project

I am a beginning programming student, and have a lab assignment due tomorrow
(2/12/98).  It is a simple program to convert a Centigrade temperature into
a Fahrenheit one.

This is a simple usage problem.  I get error 26: Type mismatch on line 9
when I attempt to compile it.  I know it has something to do with fieldwidth
and decimal placement parameters, but I can't figure out why!

Here it is.   HELP

PROGRAM Faren (Output); {A program to convert a centigrade temperature to a
Fahrenheit Temperature}
CONST
   CENTIGRADE=100.00;           {The Centigrade Temperature}
VAR
   FAHRENHEIT:
     Real;
BEGIN
  FAHRENHEIT := (9/5)*CENTIGRADE+32;
  Writeln ('Centigrade= '+ CENTIGRADE:6:1);
  Writeln ('Fahrenheit= '), FAHRENHEIT:6:1);
END.

 

Re:HELP!! Please help beginner w/ easy lab project


Quote
> I am a beginning programming student, and have a lab assignment due tomorrow
> (2/12/98).  It is a simple program to convert a Centigrade temperature into
> a Fahrenheit one.
> This is a simple usage problem.  I get error 26: Type mismatch on line 9
> when I attempt to compile it.  I know it has something to do with fieldwidth
> and decimal placement parameters, but I can't figure out why!
> Here it is.   HELP

> PROGRAM Faren (Output); {A program to convert a centigrade temperature to a
> Fahrenheit Temperature}
> CONST CENTIGRADE=100.00;           {The Centigrade Temperature}
> VAR  FAHRENHEIT: Real;
> BEGIN
>   FAHRENHEIT := (9/5)*CENTIGRADE+32;

    Writeln ('Centigrade= ',CENTIGRADE:6:1);
    Writeln ('Fahrenheit= ',FAHRENHEIT:6:1)

Quote
> END.

   Just 2 sloppy coding mistakes - in the lines I've corrected.  Compare
them to the code you posted.

Re:HELP!! Please help beginner w/ easy lab project


In article <6bthfm$...@examiner.concentric.net>, murp...@concentric.net
says...
:I am a beginning programming student, and have a lab assignment due tomorrow
:(2/12/98).  It is a simple program to convert a Centigrade temperature into
:a Fahrenheit one.
:
:This is a simple usage problem.  I get error 26: Type mismatch on line 9
:when I attempt to compile it.  I know it has something to do with fieldwidth
:and decimal placement parameters, but I can't figure out why!
:
:Here it is.   HELP
:
:
A bit of modification is needed ......., This will do just fine, I guess.

PROGRAM Faren (Output); {A program to convert a centigrade temperature to
Fahrenheit Temperature}

CONST
   CENTIGRADE=100.00;           {The Centigrade Temperature}
VAR
   FAHRENHEIT:
     Real;
BEGIN
  FAHRENHEIT := (9/5)*CENTIGRADE+32;
  Writeln ('Centigrade= ', CENTIGRADE:6:1);
  Writeln ('Fahrenheit= ', FAHRENHEIT:6:1);
END.

Other Threads