Having trouble combining sketches

I'm relatively new to programming and having a hard time combining two sketches. The first sketch is reading a fluid flow sensor and then displaying it on a lcd, the second sketch is reading a temperature sensor and also displaying it on a lcd.

Now the trouble i am having is actually combining the two seperate sketches and getting it to compile correctly. Both sketches work flawlessly on their own. What i would like is to display my flow rate on the top line and have the temperature dispalyed under the flow rate.

Any help would be greatly appreciated. Zack.

Heres the flow sensor sketch

//code by Crenn from http://thebestcasescenario.com
//project by Charles Gantt from http://themakersworkbench.com
/*
The circuit:

  • LCD RS pin to digital pin 12
  • LCD Enable pin to digital pin 11
  • LCD D4 pin to digital pin 6
  • LCD D5 pin to digital pin 5
  • LCD D6 pin to digital pin 4
  • LCD D7 pin to digital pin 3
  • LCD R/W pin to ground
  • 10K resistor:
  • ends to +5V and ground
  • wiper to LCD VO pin (pin 3)
  • flow sensor output digital pin 2
    */

/*To
disable interrupts:
cli(); // disable global interrupts

and to enable them:
sei(); // enable interrupts
*/
// include the library code:
#include <LiquidCrystal.h>

//Varibles used for calculations
int NbTopsFan;
int Calc;

//The pin location of the sensor
int hallsensor = 2;

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 6, 5, 4, 3);

typedef struct{ //Defines the structure for multiple fans and their dividers
char fantype;
unsigned int fandiv;
}fanspec;

//Definitions of the fans
fanspec fanspace[3]={{0,1},{1,2},{2,8}};

char fan = 1; //This is the varible used to select the fan and it's divider, set 1 for unipole hall effect sensor
//and 2 for bipole hall effect sensor

void rpm () //This is the function that the interupt calls
{
NbTopsFan++;
}

//This is the setup function where the serial port is initialised,
//and the interrupt is attached
void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);

pinMode(hallsensor, INPUT);
Serial.begin(9600);
attachInterrupt(0, rpm, RISING);

}
void loop ()
{
NbTopsFan = 0; //Set NbTops to 0 ready for calculations
sei(); //Enables interruptsz
delay (250); //Wait .25 second
cli(); //Disable interrupts
Calc = (NbTopsFan * 60); //(Pulse frequency x 60) / 7.5Q, = flow rate
//Times NbTopsFan (which is apprioxiamately the fequency the fan is spinning at) by 60 seconds before dividing by the fan's divider
Serial.print (Calc, DEC); //Prints the number calculated above
Serial.print (" Flow\r\n"); //Prints " Flow" and a new line
lcd.clear();
lcd.print("CC/MIN:");
lcd.print(Calc);

}

Here's the sketch for the thermistor

#include <math.h>

double Thermistor(int RawADC) {
// Inputs ADC Value from Thermistor and outputs Temperature in Celsius
// requires: include <math.h>
// Utilizes the Steinhart-Hart Thermistor Equation:
// Temperature in Kelvin = 1 / {A + B[ln(R)] + C[ln(R)]^3}
// where A = 0.0014415805, B = 0.000234125 and C = 8.76741E-08
long Resistance;
double Temp; // Dual-Purpose variable to save space.
Resistance=((10240000/RawADC) - 10000); // Assuming a 10k Thermistor. Calculation is actually: Resistance = (1024 * BalanceResistor/ADC) - BalanceResistor
Temp = log(Resistance); // Saving the Log(resistance) so not to calculate it 4 times later. // "Temp" means "Temporary" on this line.
Temp = 1 / (9.740792E-4 + (1.8975884E-4 * Temp) + (7.3849657E-7 * Temp * Temp * Temp)); // Now it means both "Temporary" and "Temperature"
Temp = Temp - 273.15; // Convert Kelvin to Celsius // Now it only means "Temperature"
return Temp; // Return the Temperature
}

void printDouble(double val, byte precision) {
// prints val with number of decimal places determine by precision
// precision is a number from 0 to 6 indicating the desired decimal places
// example: printDouble(3.1415, 2); // prints 3.14 (two decimal places)
Serial.print (int(val)); //prints the int part
if( precision > 0) {
Serial.print("."); // print the decimal point
unsigned long frac, mult = 1;
byte padding = precision -1;
while(precision--) mult *=10;
if(val >= 0) frac = (val - int(val)) * mult;
else frac = (int(val) - val) * mult;
unsigned long frac1 = frac;
while(frac1 /= 10) padding--;
while(padding--) Serial.print("0");
Serial.print(frac,DEC) ;
}
}

void setup() {
Serial.begin(115200);

}

#define ThermistorPIN 0 // Analog Pin 0
double temp;
void loop() {
temp=Thermistor(analogRead(ThermistorPIN)); // read ADC and convert it to Celsius
Serial.print("Sen.1 ");
printDouble(temp,2); // display Celsius
Serial.print("c ");
temp = (temp * 9.0)/ 5.0 + 32.0; // converts to Fahrenheit
Serial.print("");
printDouble(temp,2); // display Fahrenheit
Serial.println("f"); // End of Line
delay(100); // Delay a bit... for fun, and to not Serial.print faster than the serial connection can output
//lcd.clear();

}

char fan = 1;

A byte is the same size as a char, and typically contains numeric values (1, 2, etc.), while a char typically contains character values ('1', '2', etc.).

   sei(); //Enables interruptsz
   delay (250); //Wait .25 second
   cli(); //Disable interrupts

This means that interrupts are disabled most of the time. Why?

Now the trouble i am having is actually combining the two seperate sketches and getting it to compile correctly.

Where is your attempt to combine the sketches? Typically, all the global variables and include statements are copied from each sketch to the combined sketch, then all the setup() code from both sketches is copied to the new setup() function, with duplicate statements removed (no need for two LCD.begin() statements, for instance), then all the loop() code from both sketches is copied to the new loop() function. Next, any user-added functions from the two source sketches are copied. Finally, the logic in loop() is straightened out to perform both actions in the correct order/place.

What I would suggest is to first get the structure of your program working. Start from scratch with a new sketch.
Get the LCD to work as you want.
Look at the library examples for the LCD and use some of the functions provided.
Then get the flow sensor to work by pasting the functions into the new sketch. Add only the declarations that are needed by the functions. Compile after every change.
The do the Thermistor code the same way. This might seem like the long way round but believe me in the end it is the best.

If you have problems with the LCD, PM me and I will sort you out with some code.