* This code is ran under Microsoft Visual C++ 2008 Express Edition.
* So when I do run the program, it runs, it lets me input 'The Name', 'Resistance Value', and 'Tolerance Value'.
*It then displays The maximum and minimum resistance.
*Now here's the problem!--It displays hexadecimals.
*HERE'S MY CODE
#include <iostream>
#include <string>
using namespace std;
class CResistor
{
public:
void InputInfo()
{
cout<<"Enter a text name for the CResistor object being created."<<endl;
cin>>m_sResName;
cout<<"\n";
cout<<"Enter the Following Data:"<<endl;
cout<<"Resistance Value= ";
cin>>Res0;
cout<<"Tolerance Value= ";
cin>>Res1;
ResTolValue=(Res0*Res1);
Res2=(Res0+ResTolValue);
Res3=(Res0-ResTolValue);
cout<<":Max Resistance= "<<Res2<<endl;
cout<<":Min Resistance= "<<Res3<<endl;
cout<<"\n";
}
void DisplayResistor()
{
cout<<"\nDisplay:";
cout<<m_sResName<<endl;
cout<<Res0<<endl;
cout<<"Current Tolerance: "<<Res1<<endl;
cout<<"Max: "<<Res2<<endl;
cout<<"Min: "<<Res3<<endl;
}
void EnterResistance()
{
cout<<"\n";
cout<<"Current Resistance: "<<Res0<<endl;
cout<<"Enter New Resistance: "<<endl;
cin>>Res0;
while(Res0<=0||Res0>10000000)
{
cin>>Res0;
}
cout<<"Currrent Tolerance: "<<Res1<<endl;
cout<<"Enter New Tolerance: "<<endl;
cin>>Res1;
while(Res1<=0||Res1>50)
{
cin>>Res1;
}
ResTolValue=(Res0*Res1);
Res2=(Res0+ResTolValue);
Res3=(Res0-ResTolValue);
}
private:
double ResTolValue;
double Res0,Res1,Res2,Res3 ;
string m_sResName;
};
int main()
{
CResistor First;
First.InputInfo();
CResistor Second;
Second.DisplayResistor();
CResistor Third;
Third.EnterResistance();
CResistor Last;
Last.DisplayResistor();
return 0;
}