Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <array>
- using namespace std;
- class add_shit {
- protected:
- array <int, 5> n; //These are protected, but you see they still work all over the code.
- float total = 0;
- public:
- void getNums() { //Fucked me for a whole week, this array shit. But I think I got it till here.
- for (int i = 0; i < 5; i++) {
- cout << "Please enter value: "; cin >> n[i];
- total = total + n[i];
- }
- }
- };
- class FruitNum : public add_shit { //This is the derived class, but still we're going to add another functionality.
- public:
- void divisionOfShit(){
- cout << "Your total is: " << total << endl;
- cout << "And divided into people: " << total / 5;
- }
- };
- int main()
- {
- FruitNum f1;
- f1.getNums();
- f1.divisionOfShit();
- cout << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement