1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MAVERICK [17]
3 years ago
10

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMile

s. Sample output for the given program:Min miles: -10Max miles: 40#include using namespace std;int main( ) { const int NUM_ROWS = 2; const int NUM_COLS = 2; int milesTracker[NUM_ROWS][NUM_COLS]; int i = 0; int j = 0; int maxMiles = -99; // Assign with first element in milesTracker before loop int minMiles = -99; // Assign with first element in milesTracker before loop milesTracker[0][0] = -10; milesTracker[0][1] = 20; milesTracker[1][0] = 30; milesTracker[1][1] = 40; /* Your solution goes here */ cout << "Min miles: " << minMiles << endl; cout << "Max miles: " << maxMiles << endl;}
Computers and Technology
1 answer:
ryzh [129]3 years ago
6 0

Answer:

Following are th program in the C++ Programming Language.

#include <iostream>//set Header files

using namespace std;//set namespace

//define main function

int main()

{

//set integer constants variable

const int NUM_ROWS = 2;

//set integer constants variable

const int NUM_COLS = 2;

//set integer type array

int milesTracker[NUM_ROWS][NUM_COLS];

//set integer type variable and initialize to 0

int i = 0;

//set integer type variable and initialize to 0

int j = 0;

//set integer type variable and initialize to -99

int maxMiles = -99;

//set integer type variable and initialize to -99

int minMiles = -99;

//initialize the value in the two dimensional array

milesTracker[0][0] = -10;

milesTracker[0][1] = 20;

milesTracker[1][0] = 30;

milesTracker[1][1] = 40;

//here is the solution  

maxMiles = milesTracker[0][0];

minMiles = milesTracker[0][0];

/*set for loop to find the minimum miles and maximum miles*/

for (i = 0; i < NUM_ROWS; i++)

{

 for (j = 0; j < NUM_COLS; j++)

 {

 //set if condition for maxMiles is the bigger than

   if (milesTracker[i][j] > maxMiles)

   //initialize milesTracker[i][j] to maxMiles

     maxMiles = milesTracker[i][j];

   //set if condition for minMiles is the smaller than

   if (milesTracker[i][j] < minMiles)

   //initialize milesTracker[i][j] to maxMiles

     minMiles = milesTracker[i][j];

 }

}

//print output

cout << "Min miles: " << minMiles << endl;

//print output

cout << "Max miles: " << maxMiles << endl;

return 0;

}

<u>Output:</u>

Min miles: -10

Max miles: 40

Explanation:

Here, we define the main method and inside it:

  • set two constant integer type variable and initialize to 2
  • set integer type two-dimensional array and pass constant variables in it.
  • Set two integer type variable and initialize to 0 then, again set two integer type variable and initialize to -99.
  • Initialize the values in the two-dimensional array.
  • Set two for loop for the two-dimensional array to find the minimum and maximum miles.
  • Set two if condition to find bigger or smaller miles.

Finally, print the maximum and the minimum miles then, return 0.

You might be interested in
What is the function for displaying differences between two or more scenarios side by side?
deff fn [24]

Answer:

its d

Explanation:

3 0
3 years ago
Read 2 more answers
Direct Mapped Cache. Memory is byte addressable. Fill in the missing fields based upon the properties of a direct-mapped cache.
xz_007 [3.2K]

The question given is incomplete and by finding it on internet i found the complete question as follows:

Direct Mapped Cache.

Memory is byte addressable

Fill in the missing fields based upon the properties of a direct-mapped cache. Click on "Select" to access the list of possible answers Main Memory Size Cache Size Block Size Number of Tag Bits 3 1) 16 KiB 128 KiB 256 B 20 2) 32 GiB 32 KiB 1 KiB 3) 64 MiB 512 KiB 1 KiB Select] 4 KiB 4) 16 GiB 10 Select ] Select ] 5) 10 64 MiB [ Select ] 6) Select] 512 KiB 7

For convenience, the table form of the question is attached in the image below.

Answers of blanks:

1.  3 bits

2. 20 bits

3. 64 MB

4. 16 MB

5. 64 KB

6. 64 MB

Explanation:

Following is the solution for question step-by-step:

<u>Part 1:</u>

No. of Tag bits = No. of bits to represent

Tag bits = Main memory - cache size bits -------- (A)

Given:

Main memory = 128 KB = 2^7 * 2^{10} = 2^{17}

Cache Memory  = 16 KB = 2^4 * 2^{10}= 2^{14}

Putting values in A:

Tag bits = 17 - 14 = 3 bits

<u>Part 2:</u>

Tag bits = Main memory - cache size bits -------- (A)

Given:

Main memory = 32 GB = 2^5 * 2^{30} = 2^{35}

Cache Memory  = 16 KB = 2^5 * 2^{10}= 2^{15}

Putting values in A:

Tag bits = 35 - 15 = 20 bits

<u>Part 3:</u>

Given:

Tag bits = 7

Cache Memory = 512 KB = 2^9 * 2^{10}  = 2^{19}

So from equation A

7 = Main Memory size - 19

Main Memory = 7 + 19

Main memory = 26

OR

Main Memory = 2^6 * 2^{20} = 64 MB

<u>Part 4:</u>

Given that:

Main Memory Size = 2^4 * 2^{30} = 2^{34}

Tag bits = 10

Cache Memory Bits = 34 - 10 = 24

Cache Memory Size = 2^4 * 2^{20} = 16 MB

<u>Part 5:</u>

Given that:

Main Memory Size  = 64 MB = 2^6 * 2^{20}

Tag bits = 10

Cache Memory Bits = 26 - 10 = 16

Cache Memory Size = 2^{16} = 2^6 * 2^{10} = 64 KB

<u>Part 6:</u>

Cache Memory = 512 KB = 2^9 * 2^{10} = 2^{19}

Tag Bits = 7

Main Memory Bits = 19 + 7 = 26

Main Memory size = 2^{26} = 2^6 * 2^20 = 64 MB

i hope it will help you!

6 0
3 years ago
________ is used for supervisory messages at the internet protocol layer.
Natalija [7]
"ICMP" <span>is used for supervisory messages at the internet protocol layer.
ICMP stands for </span>Internet Control Message Protocol and it refers to a supporting protocol in the Internet protocol suite. It is utilized by network devices which includes routers and these are used to send error messages and operational data showing, for instance, that asked for service which isn't accessible or that a host or switch couldn't be come to.
4 0
3 years ago
I recorded a video on my windows PC, but when i tried to play it i got this message:
Anit [1.1K]

Answer:

yes. Look up popular video repair sites and download it (unless its online) but dont just go clicking on random things you dont want to give yourself a virus XD

Explanation:

7 0
2 years ago
Read 2 more answers
Convert<br> 0.625 to binary
Anastaziya [24]

\huge{ \rm{Question:}}

Convert

0.625 to binary

\huge{ \rm{Answer:}}

Translate 0.625 into a fraction. We all know that 0.5 is ½. We know that the remainder, 0.125, is ⅛. Add them together, and you get ½ + ⅛ = ⅝.

Now, in binary, the positions to the right of the point are , which is ½, ¼, and ⅛ respectively.

⅝ is 5 × ⅛. 5 in binary is 101. So, ⅝ is

= 0.101

8 0
2 years ago
Other questions:
  • An example of an email client is:<br> A.)Yahoo<br> B.)Gmail<br> C.)Outlook<br> D.)All of the Above
    9·1 answer
  • Is full dive vr possible and can we accomplish it with today’s technology? Explain why
    13·2 answers
  • Edhesive 3.2 Lesson Practice question 1
    5·1 answer
  • What important feature of an email gives you a clue about what the sender wants to tell you?
    12·2 answers
  • What is a difference between a waxing crescent and a waning gibbous? (1 point) waxing crescent: first quarter waning gibbous: th
    11·1 answer
  • Donna often travels around the world. When she travels, she needs to access her emails from different locations. However, to kee
    6·2 answers
  • Which components exist in the contextual tab for tables called Design? Check all that apply.
    15·2 answers
  • Laptop computers use PCMCIA cards, another type of ________
    15·1 answer
  • Many people are scared of the rise of Artificial Intelligence (AI). Do you think computers that are controlled by an AI are some
    11·2 answers
  • Describe the method used by operating systems to differentiate between TCP connections.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!