head:- #ifndef RESISTOR_H
- #define RESISTOR_H
- using namespace std;
- #include<string>
- #include<iostream>
- enum colorre{BLACK=0, BROWN=1, RED=2, ORANGE=3, YELLOW=4, GREEN=5, BLUE=6, VIOLET=7, GREY=8, WHITE=9};
- enum colorto{SILVER=10, GOLD=5};
- class resistor
- {
- colorre colorre1,colorre2,colorre3;
- colorto colortole;
- string color;
- double tolerance;
- public:
- double r;
- resistor();
- resistor(double a);
- ~resistor();
- void setresistor(string a);
- void setresistor(double a);
- void string_to_enum();
- colorre toenum1(string a);
- colorto toenum2(string a);
- void outcolorresistor();
- void computeresistor();
- void outresistor();
- resistor operator+(resistor other);
- resistor operator||(resistor other);
- };
- #endif // RESISTOR_H
複製代碼 |