Unit 7th-Job 1:oj programming
View Help
return
Warm tips:
1. This assignment belongs to the online Judge topic and is enigmatic grading by the system immediately after submission.
2. Students can submit an unlimited number of answers before the deadline , and the system will take the highest score as the final result.
This job is the 7th Unit job series.
There is a "back-and-forth dependency" between "multiple Jobs" in this module.
The work in this unit should be completed "in order".
In accordance with the terms of academic integrity, I guarantee that this work is done independently.
1 read the code given, understand the main functions and principles of the Code to supplement the missing code submission OJ enigmatic grading (10 points)
Topic content:
Creates a screen screens object in singleton mode.
For details and operational requirements, see "unit Job 1 description" in section X of unit seventh.
Input format:
Two integers separated by a space, representing the screen resolution
Output format:
Two integers separated by a space, representing the screen resolution. followed by a newline character.
Input Sample:
800 600
Sample output:
800 600
time limit: 500ms memory limit: 32000kb
#include <iostream> #include <limits>using namespace std;class screen {private://----complements multiple data domain members// Getting/Releasing graphics window resources in the screen class is a Raii method//For RAII, see the Exception Handling unit material unsigned int width;unsigned int height;static screens *instance; screen (unsigned int width, unsigned int height) {//If the graphics library is enabled, the function that initializes the graphics mode is placed here//Initgraph (Width_, Height_);this-> width = width;this->height = height;}; ~screen () {///If the graphics library is enabled, the function to turn off graphics mode is placed here//Closegraph ();d elete instance;instance = NULL;} public://----Supplement GetWidth () with getheight () function, unsigned int getwidth () {return width;} unsigned int getheight () {return height;} Static screen* getinstance (unsigned int width = 640, unsigned int height = 480) {//Singleton mode//----supplemental function body screen* ret = instance; if (ret = = NULL) {instance = new screen (width, height); ret = instance;} return ret;}}; screen* screen::instance = 0;//----The Special data member initialization statement of the screen class int main () {int width, height; screen* screen = 0;cin >> width >> height;screen = screen::getinstance (width, height); screen = Screen::gEtinstance (); cout << screen->getwidth () << "<<screen->getheight () << endl;// GCC and VC compilers are paused in debug mode for easy viewing of Run results # if (defined (__debug__) | | defined (_DEBUG)) Cin.ignore (numeric_limits<streamsize> :: Max (), ' \ n '); Cin.get (); #endifreturn 0;}
Introduction to the _c++ program design of NetEase Cloud Classroom (Next) _ Unit 7th: In and out of the same interest, all the appropriate – file input and Output _ 7th Unit-Job 1:oj programming