Hi everyone, im not competely new to C++ but we are being asked to create a new program for converting celsius to farenheit which is an easy code set, but we have to create it using seperate units, which i have to admit is massivley confusing me !

#pragma hdrstop
#include "temps.h"
#pragma package(smart_init)

//---------------------------------------------------------------------------
  double convert(double cels)
  {
        double cels = Temp->Text.ToDouble();
        double faren = 9 * cels;
        faren / 5;
        faren + 32;

   }

My question would be to execute this code and output in a text box named Output what code should be executed in the main file ?

Appreciate any help been reading here for a while, but never posted before !

Something like Output->Text = faren.ToString(); perhaps?

Why not just do the math on one line? Keeps things short, and not spasmodically spread out as you write more involved code.

Right MozaicFuneral. As far as I know the code will not even compile, but I just answered a question.

Thats the way that i would do it as well, but the instruction was to put the logical maths in 1 unit, and then have the main unit call a function from it...

I get how to do the rest its just calling the unit that has me confused.

Ive only done line by line programming, i understand the calling another unit to keep the code easily separated but its to notation i dont get.

You don't call a unit as you call it, you include it.
Then you are able to use all the functions etc. in the unit.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.