Hi!
Thanks for the help regarding vectors :) It really helped me.
Now, I have a problem regarding classes. I do not know the problem in this program
#include <iostream.h>
#include <ctype.h> //islower(), toupper()
#include <stdlib.h> //exit( )
class Temp
{
public:
Temp( );
Temp(double initDeg, char initScale);
double Degrees();
char Scale();
Temp Fahrenheit( );
Temp Celsius( ); //needed to work on
Temp Kelvin( ); //needed to work on
void Read( );
void Print( );
private:
double myDegree;
char myScale;
};
Temp Temp :: Fahrenheit( )
{//converting to Fahrenheit
switch(myScale)
{
case ‘F’: return Temp(myDegrees, ‘F’);
case ‘C’: return Temp(myDegrees*1.8+32.0, ‘F’);
case ‘K’: return Temp(myDegrees-273.15, ‘F’);
}
}
void main()
{
cout<<"This program shows the Fahrenheit, Celcius,"
<<" and Kelvin equivalents of a temperature.\n\n";
char response;
Temp theTemp; //construction
do
{ cout<<"Enter a temperature(e.g., 98.6 F): ";
cin>>theTemp; //input
cout<<"-->"
<<theTemp.Fahrenheit()
<<" = "
<<theTemp.Celcius()
<<" = "
<<theTemp.Kelvin()
<<endl;
cout<<"\nDo you want to have more temperature conversion?";
cin>>response;
}while(response=='Y' || response=='y');
}
Please help me! Thanks :)