How to complete the user define function; I did 3 functions

#include<iostream>
#include <iomanip>
using namespace std;
void convertFtoC(int); // converte function F to C
void convertCtoF(int); // converte function C to F
void print (int);
int main()
{
char choice; // Choice between c for Celsius and f for Fahrenheit
int degree; // the degree the user input
int convertCtoF, convertFtoC; // to convert either Celsius or Fahrenheit

while(choice == 'c' || choice == 'f' || choice == 'C' || choice == 'F')
cout<<"This program converts the degrees from Fahrenheit to Celsius and vice versa."<<endl;
cout<<"\n\nThe following are the options:\n "<<endl;
cout<<"Press C to convert from Celsius to Fahrenheit"<<endl; // choice C
cout<<"Press F to convert from Fahrenheit to Celsius"<<endl; // choice f
cout<<"Press any other key to EXIT the program\n"<<endl; // any key to EXIT
cout<<"Please Enter your choice: "<<endl;
cin>>choice;
{

if(choice == 'c' || choice == 'C' )
{ // for option C

convertCtoF(degree); // call converte function
print (degree); // call print function

}
else if(choice == 'f' || choice == 'F' )
{
convertFtoC(degree); // call converte function
print (degree); // call print function

}

} // close the wile loop
return 0;
}

void convertCtoF(int& calc){ // function to calculate from C to F
int calc, conv;
cout<<"Enter Fahrenheit degrees for conversion: "<<endl;
cin>>calc;
conv=calc * (9/5) + 32;

}
void convertFtoC(int& calc){ // function to calculate from F to C
int calc, conv;
cout<<"Enter Fahrenheit degrees for conversion: "<<endl;
cin>>calc;
conv=(calc - 32) * 5/9;

}

void print(int cdegree){ // function to print the result

if (choice == 'c' || choice == 'C' )
{
cout << "\n" << setfill ('*') << setw(65);
cout << "\nYou entered "<<temp<<" Centigrade, which is: "<<conv<<" Fahrenheit."<<endl;
cout << setfill ('*') << setw(86);
}

elese if (choice == 'f' || choice == 'F' )
{
cout << "\n" << setfill ('*') << setw(64);
cout << "\nYou entered "<<temp<<" Fahrenheit, which is: "<<conv<<" Centigrade."<<endl;
cout << setfill ('*') << setw(84);
}
}
}
Topic archived. No new replies allowed.