Question

Assume that a two dimensional integer array myTable[NUM_ROWS] [NUM_COLS]has already declared and initialized. Which XXX/YYY will...

Assume that a two dimensional integer array myTable[NUM_ROWS] [NUM_COLS]has already declared and initialized. Which XXX/YYY will find the minimum value of all the elements in the array?

int minVal;

XXX:

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

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

if(YYY){

minVal = myTable[i][j];

-----------------------------------------------

Consider the following array definition:

int coins[] = {1,5,10,25,50,100);

what will the following statement display? Not sure if thats a star or a quote * or "

cout<< *(coins + 3);

}

}

}

A.) minVal = 0/ myTable[i][j] > minVal

B.)minVal = myTable[0][0] / myTable[i][j] > minVal

C.)minVal = 0/ myTable[i][j] < minVal

D.)minVal = myTable[0][0] / myTable[i][j] < minVal

Homework Answers

Answer #1

In order to find the minimum value in the two dimensional array, first we will assign a variable(here, minVal) equal to the value of first element of the array and then we will iterate through each element of array and check if that element is less than the variable minVal then we will assign the value to minVal as that current element.

So, here correct option is option(D) i.e. minVal = myTable[0][0] / myTable[i][j] < minVal

cout<<*(coins + 3) will print the fourth element of the array because when we write only coins, it is the pointer pointing to the first element of the array and when we add 3 to the coins then it started pointing to the fourth element of the array and *(coins + 3) represents the value present at the address to which coins + 3 is pointing to i.e. the fourth element of the array coins. Fourth element of array is 25 so it will print 25.

PLEASE UPVOTE IF YOU LIKED THE ANSWER

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Functions displayGrades and addGrades must be rewritten so that the only parameters they take in are...
Functions displayGrades and addGrades must be rewritten so that the only parameters they take in are pointers or constant pointers. Directions: Using the following parallel array and array of vectors: // may be declared outside the main function const int NUM_STUDENTS = 3; // may only be declared within the main function string students[NUM_STUDENTS] = {"Tom","Jane","Jo"}; vector <int> grades[NUM_STUDENTS] {{78,98,88,99,77},{62,99,94,85,93}, {73,82,88,85,78}}; Be sure to compile using g++ -std=c++11 helpWithGradesPtr.cpp Write a C++ program to run a menu-driven program with the...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*;...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*; import javax.swing.*; public class Clicker extends JFrame implements ActionListener {     int count;     JButton button;     Clicker() {         super("Click Me");         button = new JButton(String.valueOf(count));         add(button);         button.addActionListener(this);         setSize(200,100);         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         setVisible(true);     }     public void actionPerformed(ActionEvent e) {         count++;         button.setText(String.valueOf(count));     }     public static void main(String[] args) { new Clicker(); } } a. add(button);...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT