This is what I have of my code so far but I cant get it to work right, Can someone help me fix this

I need to make a float function that converts celsius to fahrenheit but im not totally sure how to do it

I also need to make a function based on what the fahrenheit temp is and make it return the state water would be in at that temp

thanks

-Mason

#include <iostream>
#include <string>

using namespace std;

float cel_to_far (float celsius);
string state_of_water (float fahrenheit);

float celsius;
float fahrenheit;

int main ()
{
cout << "Enter the degrees of water in in celsius.       ";
cin >> celsius;
cout << endl;
cout << "When you have " << celsius << " degrees celsius, that is equal to " << cel_to_far << " degrees fahrenheit" << endl;
cout << endl;
cout << state_of_water << endl;

return 0;
}

float cel_to_far (float celsius)
{
	fahrenheit = celsius * 9 / 5 + 32;
	return fahrenheit;
}

string state_of_water (float fahrenheit)
{
	if (fahrenheit <= 32)
		return "Solid (ice)";
	if (fahrenheit >= 33 && fahrenheit <= 211)
		return "Liquid (water)";
	else
		return "Gas (steam)";
}

Actually, just to save you some time. Here are the corrections:

#include <iostream>
#include <string>
 
using namespace std;
 
float cel_to_far (float celsius);
string state_of_water (float fahrenheit);
 
float celsius;
float fahrenheit;
 
int main ()
{
cout << "Enter the degrees of water in in celsius.       ";
cin >> celsius;
cout << endl;
cout << "When you have " << celsius << " degrees celsius, that is equal to " << cel_to_far(celsius) << " degrees fahrenheit" << endl;
cout << endl;
cout << state_of_water(fahrenheit) << endl;
 
return 0;
}
 
float cel_to_far (float celsius)
{
	fahrenheit = celsius * 9 / 5 + 32;
	return fahrenheit;
}
 
string state_of_water (float fahrenheit)
{
	if (fahrenheit <= 32)
		return "Solid (ice)";
	if (fahrenheit >= 33 && fahrenheit <= 211)
		return "Liquid (water)";
	else
		return "Gas (steam)";
}

*You just needed to state the parameters in the function.*

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.