Guest User

Untitled

a guest
Apr 16th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #include <iomanip>
  5. #include <string>
  6.  
  7. using namespace std;
  8.  
  9. class Factor {
  10.     double a;
  11.     double b;
  12.    
  13.     public:
  14.         void setA(double val);
  15.         void setB(double val);
  16.         double getA()
  17.         double getB();
  18.         double getAB();
  19.         Factor();
  20. }
  21.  
  22. int main() {
  23.     Factor dubs;
  24.     dubs.setA(22);
  25.     dubs.setB(2);
  26.     cout << dubs.getB() << endl << dubs.getA() << endl << dubs.getAB() << endl;
  27.     return 9001;
  28. }
  29.  
  30. void Factor::setA(double val) { a = val; }
  31. void Factor::setB(double val) { b = val; }
  32.  
  33. double Factor::getA() { return a; }
  34. double Factor::getB() { return b; }
  35. double Factor::getAB() { return a * b; }
  36. Factor::Factor() { a = 1; b = 1; }
Add Comment
Please, Sign In to add comment