tatic const int MAX_SIZE=10; / Return the max value tatic double max(double d1) static double lastMax = e; lastMax = (d1 > lastMax) ? di : lastmax; return lastmax; / singleton class only one instance allowed lass singleton public: static singleton& getsingleton() { return theone; } // Returns the singleton friend std::ostream& operator<« (std::0stream& o, const singleton& s); private: Singleton() { }; // Prevents more instances static singleton theOne; ingleton Singleton::theOne; nt main() static singleton& s = singleton::getsingleton(); double array[MAX_SIZE] = { 1.1, 5.5, 3.3, 7.7, 4.4, 9.9, 2.2, 6.6, 8.8, e }; for (double maxval : array) std::cout <« "max: " « max(maxval) « std::endl; std::cout « s; return e; / insertion operator<< td::ostream& operator<« (std: :ostream& o, const singleton& s) O s "Outout sineleton\n":
tatic const int MAX_SIZE=10; / Return the max value tatic double max(double d1) static double lastMax = e; lastMax = (d1 > lastMax) ? di : lastmax; return lastmax; / singleton class only one instance allowed lass singleton public: static singleton& getsingleton() { return theone; } // Returns the singleton friend std::ostream& operator<« (std::0stream& o, const singleton& s); private: Singleton() { }; // Prevents more instances static singleton theOne; ingleton Singleton::theOne; nt main() static singleton& s = singleton::getsingleton(); double array[MAX_SIZE] = { 1.1, 5.5, 3.3, 7.7, 4.4, 9.9, 2.2, 6.6, 8.8, e }; for (double maxval : array) std::cout <« "max: " « max(maxval) « std::endl; std::cout « s; return e; / insertion operator<< td::ostream& operator<« (std: :ostream& o, const singleton& s) O s "Outout sineleton\n":
Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter10: Classes And Objects
Section: Chapter Questions
Problem 7E
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT