Problem:
I am trying to make a program that will convert the temperature from Celcius to Fahrenheit and vice-versa.
The sample code is attached below:
#include <iostream>
using namespace std;
void dialouge();
int c2f();
int f2c();
int c2f()
{
int c;
int choice;
cout << "Please enter the degree in Celsius: \n";
cout << ":.: ";
cin >> c;
cout << ":F: " << c * 1.8 + 32 << endl;
cin.get();
cout << "Convert another degree?\n";
cout << "1. Yes.\n";
cout << "2. No.\n";
cout << ":.: ";
cin >> choice;
if (choice == 1)
{
dialouge();
}
else if (choice == 2)
{
return 0;
}
}
int f2c()
{
int f;
int choice;
cout << "Please enter the degree in Fahrenheit: \n";
cout << ":.: ";
cin >> f;
cout << ":C: " << f - 32 * 5 / 9 << endl;
cin.get();
cout << "Convert another degree?\n";
cout << "1. Yes.\n";
cout << "2. No.\n";
cout << ":.: ";
cin >> choice;
if (choice == 1)
{
dialouge();
}
else if (choice == 2)
{
return 0;
}
}
void dialouge()
{
int choice;
cout << "Please choose your desired option:-\n";
cout << "1. Celsius to Fahrenhite.\n";
cout << "2. Fahrenhite to Celsius.\n";
cout << ":.: ";
cin >> choice;
if (choice == 1)
{
c2f();
}
else if (choice == 2)
{
f2c();
}
}
int main()
{
cout << "This program allows you to convert from Celsius to Fahrenheit and vice versa.\n";
dialouge();
}
But the problem is: When I compile it, CodeBlocks keeps giving me the following warning:
int f2c(): control reaches end of non-void function
int c2f(): control reaches end of non-void function
what does it mean? and if there is anything wrong that I haven't noticed, please point it out.