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
Harlamova29_29 [7]
2 years ago
12

Write a program that declares a two-dimensional array named myFancyArray of the type double. Initialize the array to the followi

ng values: 23 14.12 17 85.99 6.06 13 1100 0 36.36 90.09 3.145 5.4 1. Create a function that will return the sum of all elements in the array. Call this function from main and print out the result. 2. Create a function that will use a nested loop to display all the elements in the array to the screen. Call this function from main.
Computers and Technology
1 answer:
kirill115 [55]2 years ago
7 0

Answer:

This solution is provided in C++

#include <iostream>

using namespace std;

double sumFancyArray(double myarr[][6]){

   double sum = 0.0;

   for(int i = 0;i<2;i++)    {

       for(int j = 0;j<6;j++){

       sum+=myarr[i][j];    

       }}    

   return sum;

}

void printFancyArray(double myarr[][6]){

   for(int i = 0;i<2;i++)    {

       for(int j = 0;j<6;j++){

       cout<<myarr[i][j]<<" ";    

       }

   }

}

int main(){

   double myFancyArray[2][6] = {23, 14.12, 17,85.99, 6.06, 13, 1100, 0, 36.36, 90.09, 3.145, 5.4};

   cout<<sumFancyArray(myFancyArray)<<endl;

   printFancyArray(myFancyArray);

   

   return 0;

}

Explanation:

This function returns the sum of the array elements

double sumFancyArray(double myarr[][6]){

This initializes sum to 0

   double sum = 0.0;

This iterates through the row of the array

   for(int i = 0;i<2;i++)    {

This iterates through the column

       for(int j = 0;j<6;j++){

This adds each element

       sum+=myarr[i][j];    

       }}    

This returns the sum

   return sum;

}

This method prints array elements

void printFancyArray(double myarr[][6]){

This iterates through the row of the array

   for(int i = 0;i<2;i++)    {

This iterates through the column

       for(int j = 0;j<6;j++){

This prints each array element

       cout<<myarr[i][j]<<" ";    

       }

   }

}

The main starts here

int main(){

This declares and initializes the array

   double myFancyArray[2][6] = {23, 14.12, 17,85.99, 6.06, 13, 1100, 0, 36.36, 90.09, 3.145, 5.4};

This calls the function  that returns the sum

 cout<<sumFancyArray(myFancyArray)<<endl;

This calls the function that prints the array elements

   printFancyArray(myFancyArray);

   

   return 0;

}

Download cpp
You might be interested in
Can someone write a 5 sentence summary about Virtual Assistants. Please. I'm in a rush. Personal problems.
Lyrx [107]
Virtual Assistants can be useful. Blind people can use them to be informed, browse the web, and learn new facts. They can make tasks quicker too. They can control things like your heater or air conditioner. But if one were to malfunction, it could take lives.
7 0
3 years ago
A ____ is a key-dependent, one-way hash function that allows only specific recipients(symmetric key holders) to access the messa
Alexxx [7]

Answer: (C) MAC

Explanation:

MAC is stand for the message authentication code and it is one of the key dependent hash function. Message authentication provide the data integrity and also the origin of data authentication.

  • It basically allow the specific recipients known as the holder of the symmetric key.
  • The message authentication code uses the CBC (Cipher block chaining) mode for constructing the MAC algorithm and it also uses the block cipher for the conjunction by using the CBC operations.    

On the other hand, all the options are incorrect as they are not the key dependent hash function.

Therefore, Option (C) is correct.

7 0
3 years ago
The Olympic Games that people celebrate today are much different from the Olympics that began in ancient Greece. When the Olympi
kiruha [24]

Answer:

D

Explanation:

Option D explains the best about Olympic games. previously only few games were in Olympics but now thee are variety of games and some more games are trying to be a part of future Olympic games as well. There is no explanation about other options so we discarded those options, Which includes A) Greek mythology says that the Olympics were started by Heracles. B) Women were not allowed to watch the Olympic Games in ancient Greece. C) The ancient Olympics included sport such as running and chariot racing.

8 0
3 years ago
Read 2 more answers
I need ideas for a scratch (imagine, share, and program) coding project. You can think of any project you'd like thanks! :)
alex41 [277]

You did not include enough information.

5 0
3 years ago
Read 2 more answers
true of false one reason to move to a paperless society is that printers are becoming prohibitively expensive
Yakvenalex [24]
True because printers, which require paper, are becoming more expensive. A paperless society has the advantage of being cheaper in this aspect.
5 0
3 years ago
Other questions:
  • 10 10 105 Each process is assigned a numerical priority, with a higher number indicating a higher relative priority. In addition
    8·1 answer
  • Use blank to prevent friends who have been drinking from driving
    14·2 answers
  • What is the absolute pathname of the YUM configuration file? REMEMBER: An absolute pathname begins with a forward slash
    12·1 answer
  • The main activity area or the brain of the computer is called the ________
    15·1 answer
  • Which of the following is an example of a query with an explicit location? Select all that apply. True False [walmart boston], E
    7·2 answers
  • What differentiates physical design from logical design?
    7·1 answer
  • What type of Internet monitoring technique records information about a customer during a web surfing session, such as what websi
    8·1 answer
  • Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binar
    12·1 answer
  • Michael needs to ensure that those items that are automatically archived are still easily accessible within Outlook. Which optio
    5·2 answers
  • Noi needs to send some documents to a client in another company. Which device can she use to make digital copies of the paper fi
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!