Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- class Uran233{
- private:
- double waga;
- bool masaKrytyczna;
- public:
- Uran233(double wg){
- this->waga = wg;
- if(this->waga>16){
- this->masaKrytyczna=true;
- }else{
- this->masaKrytyczna=false;
- }
- }
- void setMk(bool v){
- this->masaKrytyczna = v;
- }
- void setWg(double wg){
- this->waga = wg;
- }
- double getWg(){
- return this->waga;
- }
- bool getmK(){
- return this->masaKrytyczna;
- }
- };
- Uran233 operator += (Uran233 &a,double wg){
- a.setWg(a.getWg()+wg);
- if(a.getWg() > 16)
- a.setMk(true);
- }
- Uran233 operator -= (Uran233 &a, double wg){
- a.setWg(a.getWg()-wg);
- if(a.getWg()<16)
- a.setMk(false);
- }
- int main()
- {
- Uran233 a(15);
- cout<<"Waga :"<< a.getWg() << endl << "Masa Kryt ? : "<< a.getmK() << endl;
- a+=10;
- cout<<"Waga :"<< a.getWg() << endl << "Masa Kryt ? : "<< a.getmK() << endl;
- a-=25;
- cout<<"Waga :"<< a.getWg() << endl << "Masa Kryt ? : "<< a.getmK() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement