Guest User

Untitled

a guest
Apr 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. class DivSales
  2. {
  3. private:
  4. static int total;
  5. public:
  6. int qArr[4]; // here is the declared array I input the 4 integers
  7.  
  8. static int totalSale()
  9. {
  10. return total; // here is the function to return total.
  11. }
  12.  
  13. void fourSale(int first, int second, int third, int fourth) //these integers are inputted by user.
  14. {
  15. if (valid(first) == true) //this and below is an example of how I am adding to the total variable. Imagine 3 more of these.
  16. {
  17. qArr[0] = first;
  18. total += first;
  19. }
  20.  
  21. }
  22.  
  23. int DivSales::total = 0;
  24. int main()
  25. {
  26. DivSales div1; //here i declare an object. I have 5 more but I will display two for example purposes.
  27. div1.fourSale(6543, 3000, 4000, 5000); // here i input the 4 integers
  28.  
  29. cout << div1.totalSale << endl << endl; // here I try to print out the total however it prints the error I was talking about.
  30.  
  31. }
Add Comment
Please, Sign In to add comment