Macro definitions

Assignment Help C/C++ Programming
Reference no: EM13897410

Given the following macro definitions

#define HEIGHT 3
#define WIDTH 5

There is a multidimensional array called anArray declared as follows:

int anArray[HEIGHT][WIDTH];

Consider the following code segment:

for (int n=0;n < HEIGHT; n++) {
       //TODO: complete the for loop to populate all index numbers with the value 0.
           
}

Which of the following completed for loop could fill that previously declared anArray multidimensional array with the value 0 in each position?

 

A. for (int n=0; n < HEIGHT; n++)      
{
    for (int m=0; m < WIDTH; m++) 
    {
      int anArray[0][0];
    }
}
B. for (int n=0; n < HEIGHT; n++)      
{
    for (int m=0; m < WIDTH; m++) 
    {
      anArray[n][m] = 0;
    }
}
C. for (int n=0; n < HEIGHT; n++)      
{
            for (int m=0; m < WIDTH; m++) 
            {
            }

     anArray[n][m] = 0;        

}

D. for (int n=0; n < WIDTH; n++)      
{
    for (int m=0; m < HEIGHT; m++) 
    {
      int anArray[n][m] = { {0,0,0}{0,0,0}{0,0,0}{0,0,0|}{0,0,0}};
    }
}

Reference no: EM13897410

Questions Cloud

Identify and define any fallacies : Using an ad from a magazine, TV, or radio, describe the advertisement. Identify and define any fallacies that are in the advertisement. Explain why the ad is effective or ineffective as a persuasive tool.
Copy a multidimensional array : You have the following macro statements: #define WIDTH 5#define HEIGHT 3 You wish to copy a multidimensional array called anArray declared as follows:
What is difference between market value and investment value : What is the difference between market value and investment value? Explain your answer. What does IRR measure?  What is the decision rule? What does NPV measure?  What is the decision rule?
Analysis of a fictional character : Prepare an analysis of a fictional character. Include descriptions and cited examples for each of the following methods for characters development:
Macro definitions : Given the following macro definitions #define HEIGHT 3#define WIDTH 5 There is a multidimensional array called anArray declared as follows:
Consider the following function : Consider the following function:  Which of the following would be the best way to call this function?
The compiler to send the exception : When the throw keyword is written by itself, it is a way of asking the compiler to send the exception to another handler. If there is no other handler written by you, what happens?
Complete the equation below : The equation below shows the final product in the reaction of propan-1-ol with potassium permanganate in acidic solution. Draw the structure of the compound that forms initially in this reactionn.
Using which of the following techniques in c++ : Using which of the following techniques in C++ is it possible to have different functions with the same name?select all that apply

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Implement a point class for three-dimensional points

Implement a Point class for three-dimensional points (x,y,z). Include a default constructor, a copy constructor, a negate() function to transform the point into its negative.

  Derive class weekday from class datetime

We can retrieve any one of the date-time structure member using strftime - Derive class WeekDay from class DateTime such that WeekDay::display() will display local date time using values from the parameters and the corresponding weekday.

  Write a program to create 100 real random numbers

Write a program to create 100 real random numbers and store it into a 1-D array.

  The user enter the total rainfall for each of 12 months

Write a program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display:the total rainfall for the year,the average monthly rainfall,and the months w..

  Ohio phonebook has gotten mixed up

In an accident, the Ohio phonebook has gotten mixed up. The names are now really out of order. You and your enthusiastic, but naive, assistant Carl must fix the problem. No one can use the phonebook while you are sorting it, so every extra second of ..

  Create the roman.h and implement roman class in roman.cpp

Create the roman.h and implement the Roman class in roman.cpp. Make sure that you put in measures to prevent multiple inclusion of the header file. Test your implementation using task2a.cpp.

  Write program to count occurrences of each word in text

Write down C++ program to read following text. Count occurrences of each word in text and keep this count in list of elements containing (word, occurrence count) pairs.

  Write a program that allows user to input students names

Write a program that allows the user to input the students' names followed by their test scores and outputs the following.

  Define a function named average grade

Define a function named average grade. This function returns a double and has four double arguments, testi, test2, test3, test4. The return value should be the average, or arithmetic mean of the four arguments.

  Program which converts fahrenheit to centigrade

Design, create, and test a program which converts degrees Fahrenheit to degrees Centigrade (Celsius). The program must contain one main program and 3 functions: F2C() and C2F() and instructions()

  Write a program to determine how long (sec.)

Using the v 2  form of drag, write a program to determine how long (sec.) and how far (m) a 150 gram ball whose radius is 3.5cm would fall before it reached 75% of its terminal velocity. Assume ball falls in air whose density is 1.21 kg/m 3 , has a d..

  Demonstrate overriding of their getter and setter methods

Organize following animals using classes and virtual function. tigers,crocodile, elephants,pythons,zebras,hawks, chickens,rabbits using at least 3 properties some of the animals share. demonstrate overriding of their getter and setter methods.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd