Computers and Technology, 16.06.2020 16:57 kbruner20
Suppose a graphics program needs a function to indicate whether one rectangle is smaller than another rectangle. A rectangle is specified by its upper-left coordinate and bottom-right coordinate. If the first rectangle is (1, 1) and (2,3), and the second is (0,0) and (10,10), the function returns true.
HINTS
• Use copy paste to ensure your parameters exactly match the arguments. You can use the same names for parameters as the arguments.
• Declare local variables r1 Area and r2 Area to make your comparison expression simpler.
• Use the abs() function in cstdlib (requires #include).
• Take great care to check and recheck that your calculations involve the correct values.
Lab Functions: Rectangles sizes
Activity
main. cpp
1 #include
2 #include
3 using namespace std;
4
5 Type your code here */
6
7
8 int mainot
9 int Pixul, riyul, ribe, riyor; // x upper-left, y upper-left, x botton-right, y bottom-right
10 int r2xul, rzyul, r2xbr, rzybr;
11
12 cin >> rixul; cin >> riyul; cin >> rlxr; cin >> riyor;
13 cin >> rxul; cin >> rZyul; cin >> r2xr; cin >> rzybr;
14
15 cout << , riyul, rixbr, riyor, r2xul, r2yul, r2xor, rzybr) << endl;
16
17 return;
18
Answers: 3
Computers and Technology, 22.06.2019 20:00, Jana1517
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i. e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
Computers and Technology, 22.06.2019 22:00, lgary9462
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass. cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array. c . run this program and observe the results.
Answers: 1
Computers and Technology, 23.06.2019 08:30, Bradgarner772
Based on your knowledge of a good network, describe what you think is a perfect network would be. what kind of information and resources could users share on this network. what would the network administrator do? what kind of communication would be used?
Answers: 1
Suppose a graphics program needs a function to indicate whether one rectangle is smaller than anothe...
Mathematics, 13.04.2021 19:20
Mathematics, 13.04.2021 19:20
History, 13.04.2021 19:20
Mathematics, 13.04.2021 19:20
Mathematics, 13.04.2021 19:20
Mathematics, 13.04.2021 19:20
Mathematics, 13.04.2021 19:20