Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <array>
  3. using namespace std;
  4.  
  5. class add_shit {
  6. protected:
  7. array <int, 5> n; //These are protected, but you see they still work all over the code.
  8. float total = 0;
  9.  
  10. public:
  11. void getNums() { //Fucked me for a whole week, this array shit. But I think I got it till here.
  12. for (int i = 0; i < 5; i++) {
  13. cout << "Please enter value: "; cin >> n[i];
  14. total = total + n[i];
  15. }
  16. }
  17. };
  18. class FruitNum : public add_shit { //This is the derived class, but still we're going to add another functionality.
  19. public:
  20. void divisionOfShit(){
  21. cout << "Your total is: " << total << endl;
  22. cout << "And divided into people: " << total / 5;
  23. }
  24.  
  25. };
  26.  
  27.  
  28. int main()
  29. {
  30. FruitNum f1;
  31.  
  32. f1.getNums();
  33. f1.divisionOfShit();
  34.  
  35. cout << endl;
  36. system("PAUSE");
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement