#include <iostream>
using namespace std;
//aaron hereford
//this program asked the user to enter the temperature of freezing and boiling points and shows them of screen.
//I the temperature entered by the user
//P using ture or false statments to gain the answer
//O the output is the correcttemperature.
int Get_massage1(int point)
{
//user point to hold Freezing or Boiling points
//intorduce the user
cout<<"Welcome to F&B test program"<<endl;
cout<<"Please enter a number for Freezing or Boiling points(F): ";
cin >>point;
}
int Get_massage2(int Freezing)
{
cout<<"Test Freezing point..."<<endl;
if(Freezing>=-173) cout<<"Ethyl alcohol will freeze"<<endl;
if(Freezing>=-36) cout <<"Mercury will freeze"<<endl;
if(Freezing>=-362)cout <<"Oxygen will freeze"<<endl;
if(Freezing>=32) cout <<"Water will freeze"<<endl;
}
int Get_massage3(int Boiling )
{
cout<<"\nTest Boiling point..."<<endl;
if(Boiling<=172) cout<<"Ethyl alcohol will boil"<<endl;
if(Boiling<=676) cout<<"Mercury will boil"<<endl;
if(Boiling<=-306)cout<<"Oxygen will boil"<<endl;
if(Boiling<=212) cout<<"Water will boil"<<endl;
}
int Get_massage4()
{
cout<<"Thank you for using."<<endl<<endl<<"Program end~";
}
int main()
{
{
int massage1(int point);
Get_massage1 = massage1; //this is were i get the massage
return 0;
}
{
int massage2(int Freezing);
return 0;
}
{
int massage3(int Boiling);
return 0;
}
{
int massage4();
return 0;
}
return 0;
}
i keep getting errorC: error C2659: '=' : overloaded function as left operand
The problem is in how you are trying to use functions.
The type before a function name is the return type of the function. If the function does not return a value this should be void
Functions also need a return statement - for a void function this can be ommitted, but it is probably better to include a return; to make the code clear.
In main() you need to just decalre a single int (for the temperature entered), which then becomes the parameter for the later functions. You should not have the extra return statements - these will cause main to terminate.
1 2 3 4 5 6 7 8 9
int main()
{
int point;
point = Get_massage1(); //no parameter to this function
Get_massage2(point); //Pass point in, void so no return value
Get_massage3(point);
Get_massage4();
return 0;
}