I'm writing a simple program to calculate Heat Index. When I run it, it should check whether the Temp is Fahrenheit or Celcius, and then output the Heat Index. If the Temp is less than 80 degrees it should output " no heat index." right now it is outputting " no heat index for all inputs.
Before, it was outputting -40. for everything. Having a lot of trouble finding out what went wrong here.
#include <iostream>
#include <string>
using namespace std;
void calcheatIndex (float temp, float humidity); // function to execute HI formula
void inputWeather (float temp, float humidity); // function to get data from user
bool moreTemps (); // ask if user wants to calculate more
void temptype (); // F or C
int main () {
    float temp = 0;
    float humidity = 0;
    float heatIndex;
    inputWeather(temp, humidity);
    calcheatIndex (temp, humidity);
    return 0;
}
void inputWeather(float temp, float humidity) {
    cout << "Enter temperature: ";
    cin >> temp;
    cout << "Enter humidity: ";
    cin >> humidity;
    while (humidity <= 0) {
            cout << "Humidity should be greater than 0. ";
        cin >> humidity;
    }
}
bool moreTemps () {
    string answer;
    cout << "Calculate another (Y/N) ? ";
    cin >> answer;
    while (answer != "Y" && answer != "y" 
           && answer != "N" && answer != "n") {
        cout << "Answer Y/N : ";
        cin >> answer;
    }
    if (answer == "Y" || answer == "y") {
        return true;
    }
        return false;
}
void calcheatIndex (float temp, float humidity) {
    const double c1 = -42.379;
    const double c2 = 2.04901523;
        const double c3 = 10.14333127;
        const double c4 = -.22475541;
        const double c5 = -0.00683783;
        const double c6 = -0.05481717;
        const double c7 = 0.00122874;
        const double c8 = 0.00085282;
    const double c9 = -0.00000199;
    double heatIndex = c1 + (c2 * temp) +
                           (c3 * humidity) +
                           (c4 * temp*humidity) + 
                           (c5 * (temp*temp)) +
                           (c6 * (humidity * humidity)) +
                           (c7 * (temp * temp) * humidity) + 
                           (c8 * temp * (humidity * humidity)) +
                           (c9 * (temp * temp) * (humidity * humidity));
    string type;
    cout << "Is this temperature Fehrenhiet or Celcius (F/C) : ";
    cin >> type;
    while (type != "F" && type != "f" &&
       type != "C" & type != "c") {
        cout << "Enter F or C :";
        cin >> type;
    }
    if ((type == "F" || type == "f") && temp >= 80.0) {  // Fahrenheit and over 80`
        cout << heatIndex;
    } else if ((type == "C" || type == "c") && temp >= 26.67) {
            heatIndex = heatIndex * 9.0 / 5.0 + 32;
        cout << heatIndex;
        } else {
        cout << "no heatIndex" ;
    }
}
 
     
     
     
    