Homework Help Question & Answers

Note: Please answer the question in clear and legible steps. Nothing too advanced, this is a...

Note: Please answer the question in clear and legible steps. Nothing too advanced, this is a question for introductory C++ class. Thank you.

QUESTION:

Write C++ statements to declare the following arrays. The name of the array is up to you. Use a const int variable for the array size.

a) An array that will hold 7 integers, using an initializer list to set all values to 0.

b) An array that will hold 100 doubles.

c) An array that will hold 10 bool values.

d) An array that will hold 5 double values, using an initializer list to set the values to .25, .33, .50, .67 and .75.

e) A two-dimensional array of integers that has 3 rows and 6 columns.

0 0
Add a comment
Answer #1

a) An array that will hold 7 integers, using an initializer list to set all values to 0.

int arr1[7] = {0};

b) An array that will hold 100 doubles.

double arr2[100];

c) An array that will hold 10 bool values.

bool arr3[10];

d) An array that will hold 5 double values, using an initializer list to set the values to .25, .33, .50, .67 and .75.

double arr4[5] = {0.25, 0.33, 0.50, 0.67, 0.75};

e) A two-dimensional array of integers that has 3 rows and 6 columns.

int arr[3][6];

\color{red}Please\; upvote\;the \;solution \;if \;it \;helped.\;Thanks!?

Add a comment
Know the answer?
Add Answer to:
Note: Please answer the question in clear and legible steps. Nothing too advanced, this is a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coin

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Urgent please!!

    I'm looking for a simple code to develop a" Magic Square 4*4" that uses two "dimensional arrays" and " loops"!! I have been working on one , but still stuck on that,it would not give me the right output !!Help please!!here is the question:const int MAX = 4;int sumRow (const int square[], int row);// Precondition: square is an initialized matrix, MAX rows x MAX columns// 0 <= row < MAX// Postcondition: returns the sum of the values in rowbool unique...

  • Please answer in C++, and Please consider ALL parts of the question, especially where it asks the...

    Please answer in C++, and Please consider ALL parts of the question, especially where it asks the user for V. So there should be a "cin >> V" somewhere. The last guy did not answer it correctly so please make sure you do! Thank You!! Question 1 Write the following two functions. The first function accepts as input a two-dimensional array of integers. It returns two results: the sum of the elements of the array and the average The second...

  • Write a program that works with two arrays of the same size that are related to...

    Write a program that works with two arrays of the same size that are related to each other in some way (or parallel arrays). Your two arrays must be of different data types. For example, one array can hold values that are used in a formula that produces the contents of the second array. Some examples might be:  from a previous program, populations and the associated flowrates for those populations (an int array of populations and a double array...

  • Concepts tested by the program: Working with one dimensional parallel arrays Use of functions Use of...

    Concepts tested by the program: Working with one dimensional parallel arrays Use of functions Use of loops and conditional statements Description The Lo Shu Magic Square is a grid with 3 rows and 3 columns shown below. The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 – 9 exactly The sum of each row, each column and each diagonal all add up to the same number. s is shown below: Write a program that...

  • help with C++ code The aim of this is to practice writing template classes. You must...

    help with C++ code The aim of this is to practice writing template classes. You must use SafeArray template class and implement a SafeMatrix template class that will allow you to work with two dimensional arrays of any type. The boundaries are checked. You must be able to create instances of SafeMatrix template class like, SafeMatrix<int> m(2,3); The above statement will create a 2 by 3 dimensional array of integers. You must be able to access and set values using...

  • Submit Chapter7.java with four (4) public static methods as follows: A. Write a method called mostCommon...

    Submit Chapter7.java with four (4) public static methods as follows: A. Write a method called mostCommon that accepts an array of integers as its only parameter, and returns the int that occurs most frequently. Break ties by returning the lower value For example, {1,2,2,3,4,4} would return 2 as the most common int. B. Write mostCommon (same as above) that accepts an array of doubles, and returns the double that occurs most frequently. Consider any double values that are within 0.1%...

  • please do all in C++ code, thank you. Worth 1 point Checkpoint 7.12 Write a statement...

    please do all in C++ code, thank you. Worth 1 point Checkpoint 7.12 Write a statement that assigns the value 10 to the first elementof an array of integers named minutes. Type your program submission here Worth 1 point Checkpoint 7.14 Write a cout statement that will display contents of the second element of an array named courseNumbers Type your program submission here Submit Worth 1 point Checkpoint 7.15 Write a cin statement that will store the user's input in...

  • Write the C module intSet to implement an unordered set of integers according to the specification...

    Write the C module intSet to implement an unordered set of integers according to the specification given below. File intSet.h (downloadable off the class web pages): #ifndef INTSET_H #define INTSET_H typedef struct intsetType *intSet; intSet createSet(); // returns an intSet created at runtime using malloc void destroySet(intSet); // frees up the memory associated with its argument void clear(intSet); // clears set to empty (freeing any memory if necessary) int card(const intSet); // returns the cardinality of the set bool equals(const...

  • a) Declare and instantiate an array named scores of twenty-five elements of type int.   (b)Write a...

    a) Declare and instantiate an array named scores of twenty-five elements of type int.   (b)Write a statement that declares an array namedstreetAddress that contains exactly eighty elements of typechar. 2. In a single statement: declare, create and initialize an arraynamed a of ten elements of type int with the values of the elements (starting with the first) set to 10, 20,..., 100 respectively. 3. Declare an array reference variable, week, and initialize it to an array containing the strings "mon",...

  • I only need the "functions" NOT the header file nor the main implementation file JUST the impleme...

    I only need the "functions" NOT the header file nor the main implementation file JUST the implementations for the functions Please help, if its difficult to do the complete program I would appreciate if you could do as much functions as you can especially for the derived class. I am a beginer so I am only using classes and pointers while implementing everything using simple c++ commands thank you in advanced Design and implement two C++ classes to provide matrix...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT