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]
3 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]3 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
Convert this hexadecimal number to binary :. A07F​
Maslowich

Answer:

101000000111

Explanation:

8 0
3 years ago
Which is true about POP3 and IMAP for incoming email?
Dmitriy789 [7]

Answer:

Option B is the correct answer.

<h3>IMAP keeps email on an email server by default</h3>

Explanation:

  • POP3 stands for Post office protocol version 3. It is the one way mailing protocol that works by downloading the copy of the emails to the device so that they could be viewed offline when needed. The mails are deleted from the server once they are downloaded.
  • IMAP stands for Internet Message Access Protocol. Opposite to POP3, IMAP is the two way mailing protocol that donot download the entire content of the mail rather it downloads the headers only. The IMAP donot deletes the downloaded mails instead keep it one the server so that they could be used when ever needed.

I hope it will help you !

5 0
3 years ago
Write two cin statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a dash,
vlada-n [284]

Answer:

#include <iostream>

using namespace std;

int main()

{

   int birthMonth, birthYear;

   cout << "Enter your Birth Month and Year" << endl;

   cin>>birthMonth;

   cin>>birthYear;

   cout<<birthMonth;

   cout<<"-";

   cout<<birthYear<<endl;

   return 0;

}

Explanation:

Using C++ Programming Language, Firstly we declare to variables to hold the values for the birthMonth and birthYear. We then used a cout statement to prompt the user to input values for month and year, then three cout statements are used to display the  output according to the question's specification.

5 0
3 years ago
ACTIVITY NI MATCHING TYPE Directions: Match Column A with Column B. Write the letter of the correct answer on the space provided
Korvikt [17]

Answer:

Mark me a brainless plss i need that i am blink plss

6 0
3 years ago
Write a program that has the user input how many classes they are taking this semester and then output how many hours they will
NeTakaya

wait i don't understand: "Write a program that has the user input how many classes they are taking this semester and then output how many hours they will need to study each week."

8 0
3 years ago
Read 2 more answers
Other questions:
  • Computer program allowing the computer to communicate<br> with a hardware device
    13·1 answer
  • A virtual private network (VPN) is used to securely connect to another network over a insecure network.
    9·2 answers
  • What pressure will be shown on the high side peessure gauge (ac system on)
    12·1 answer
  • Which of the following jobs is considered part of the information technology industry?
    15·2 answers
  • All systems have ___________.
    9·2 answers
  • True or False: <br> The object reference can be used to polymorphically store any class in Java.
    13·1 answer
  • Match the item to the type.
    11·1 answer
  • PLEASE HELP!! WILL MARK BRAINLIEST!!
    9·1 answer
  • A python program for the following output using for loop.
    13·1 answer
  • List seven media features that can be used in media queries.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!