Write a program that declares a two-dimensional array named myFancyArray of the type double. Initialize the array to the following 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.

Answers

Answer 1

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;

}


Related Questions

Which sentence is an effective example of language for the following scenario?
Aaron's coworker Bryce has not been working on the team project their boss assigned them.

Answers

Answer:

"I feel like this assignment isn't a priority to you"

Explanation:

Given that I-language is a term used in the depicting or forming individuals' perception or point of view of a given situation or statement instead of the actual statement. It is fully known as Internal language.

Hence, in this case, the term "Aaron's coworker Bryce has not been working on the team project their boss assigned them, " can be translated into "I feel like this assignment isn't a priority to you" in I-Language.

Your organization has hired a penetration tester to validate the security of your environment. The penetration tester needs to document which ports are being listened on for the various servers. Which type of tool will the penetration tester most likely use

Answers

Answer:

Port scanner

Explanation:

The penetration tester would most likely use a port scanner. A port scanner can be explained to be an application that is made to check a server or host for ports that are open. This application can also be used by administrators to check their security networks so as to know those network services that are running on a host and also to know existing vulnerabilities. Attackers also use this to exploit victims.

Ismael is examining a report in Access. He needs to access a view that will be used to examine and change the structure of the report, including the ability to add or modify controls. Which view should he choose?

Design
Layout
Print Preview
Report

Answers

Answer:

The answer is "Design"

Explanation:

Reports offer an approach to view, design, and sum up the data in your Microsoft Access information base. For instance, you can make a basic report of telephone numbers for every one of your contacts, or a rundown report on the absolute deals across various locales and You can make a wide range of reports in Access, going from the easy to the complex. Start by contemplating your report's record source.

Regardless of whether your report is a straightforward posting of records or a gathered rundown of deals by area, you should initially figure out which fields contain the information you need to find in your report, and in which tables or inquiries they reside.

Create a 100-word internet company​

Answers

Answer:

The World Wide Web.

Explanation:

The World Wide Web was created at CERN in Switzerland in 1990. Today, people can pay money to access the Internet from internet service providers.

Hope this helps!

xoxo,

cafeology

What are the two types of programming languages?

Answers

Answer:

High level language.

Low level language

Explanation:

please give brainliest

We have constructed a Player Class for you. Add the following: public static variable: int totalPlayers Static variable should be an int. The value should be incremented whenever a new Player is constructed. public static variable: int maxPlayers Static variable should be an int. Set its value to 10. public static method: gameFull() The gameFull() static method should return a boolean of whether the total players is greater than or equal to the maxPlayers static variable.

Answers

Answer:

public class Player {

   public static int totalPlayers = 0;

   public static int maxPlayers = 10;  

   public static boolean gameFull() {

       return totalPlayers >= maxPlayers;

   }

   public Player() {         // Player class constructor

       totalPlayers++;

   }

}

Explanation:

The Java program defines the class Player which has two public class variables and a public method. The class constructor increases the totalPlayer variable by one for every player object created.

Outline three requirements for linear programming

Answers

linear programming has three major requirements: decision variables, objective function, and constraints.

Each of the following is a component of the telecommunications industry except _____.


spreadsheets

wired communications

broadcasting

HDTV

Answers

Hmmmmmmm I think it’s A.

Climatologist use weather balloons, stethoscopes, and satellites true or false

Answers

Answer:

False.

Explanation:

A stethoscope is a medical instrument which is used for listening to the work of the heart and lungs.  It consists of a microphone that rests on the patient's chest, and rubber tubes that bring the sound to the earphones. An ordinary stethoscope does not have any moving or electrical parts, as it only mechanically conducts sound from the patient's chest to the doctor's ear.   One of the simplest examinations that doctors perform today is listening to the lungs and heart with a stethoscope. With the help of this instrument, noises are heard during the work of the lungs and heart.

Is there anyone that knows how to work in Microsoft Access and someone that could help me on my test at 11 30am?​

Answers

Answer:

ok i help you i like it 11:30 ok

Write a function that will find the cost to send an international fax. The service charge is $7.00. It costs $0.45 per page for the first ten pages and $0.10 for each additional page. Take as parameter the number of pages to be faxed, and calculate the total amount due. The total amount due is returned to the main program.

Answers

Answer:

This function is written in python

def intlfax(pages):

    if pages <=10:

         fax = 7 + 0.45 * pages

    else:

         fax = 7 + 0.45 * 10 + 0.10 * (pages - 10)

    return fax

Explanation:

This line defines the function

def intlfax(pages):

This checks if pages is less than or equal to 10 and calculates the fax

    if pages <=10:

         fax = 7 + 0.45 * pages

If otherwise, it also calculates the fax (differently)

    else:

         fax = 7 + 0.45 * 10 + 0.10 * (pages - 10)

This returns the calculated fax

    return fax

Other Questions
Alexandra has 4 bags of beads. Some of the bags contain 3 purple beads and the rest contain 6 indigo beads. If Alexandra has 21 beads in all, how many bags of each color bead does Alexandra have?Please help me fast!! fix this paragraph/sentence to make more sense and make it sound better. how can you rephrase this?but this poor girl, She never had a chance to share her love with another person. Like the boy, her heart as well played with and broken many, many times. But the girl did not let the pain keep her down. She got up, and she got up stronger than she was before. But the love she had now, each and every day, it made her feel as though she was drowning. thank you guys for the help! it's appreciated! i hope yall are well and ok and having a happy holiday! if u ever need to talk, I'll be here to listen without judgment ^v^love you, stranger! and thx for the help! Why is the Pericycle absent in the roots and stems of some hydrophytes? On the first day of the fiscal year, a company issues a $1,000,000, 7%, 5-year bond that pays semiannual interest of $35,000 ($1,000,000 7% 1/2), receiving cash of $884,171. Journalize the entry for the issuance of the bonds. If an amount box does not require an entry, leave it blank. Yesterday, the temperature at noon was 22.5 degrees. By midnight, the temperature had decreased by 27.7 degrees. What was the temperature at midnight? He is pulling 400 feet over level ground by exerting a constant 25-pound force on the bar that makes an angle of 30 with the ground.How much work is Thomas doing to pull the wagon?10,000 foot-pounds8,660 foot-pounds7,070 foot-pounds5,000 foot-pounds Morgan's mom wants to borrow $720 to buy a new computer. The store will charge her 8% simple interest for one year. How much will she have to pay back if she pays the full amount in one year? Studying a picture of a cell taken with an electron microscope, you find that the cell has no nucleus and no mitochondria, but it does have a cell membrane. You conclude that the cell is probably from a(n) * 1 The factor of 2ax^2+4axy+3bx^2+2ay^2+6bxy^+3by^2 What is the molecular formula of a substance whose molar mass is 166.8 grams and its empirical formula is C2H4N2? Please help! the photo is below Jeffery and carrie deposit 800.00 into an savings account which earns 4%interest compounded quarterly they want to use the money in the account to go on a trip in 2 years how much will they be able to spend What is the value of-8(17-12)-2(8-(-2)-4-224 Battle of Kettle Creek SavannahSiege ofSavannahWHO?WHAT?WHEN?WHERE?WHY?HOW? You are Christmas shopping and your bill at the register is $130. You have two coupons, but you are only allowed to use one. Coupon 1 is for 10% off. Coupon 2 is for $10 off. Answer the following question 7a-7b-7c what was the first part of American society that was attacked because of the red scare 2?a. the movie industryb. the automobile industryc. the steel workers association The first column contains five pairs of relationships. Determine if each pair formsa proportional relationship. Mark *Proportional" or "Not Proportional" for eachrelationship in the table on your answer document. What defines a Shakespearean play as a comedy? (Use the choices below)It has a happy ending, often involving in a marriage.The plot is universal, meaning anyone can relate to it.It has five acts, with the third act having the highest point of tension.The antagonist turns out to be "the good guy" say at the end. Warren Company plans to depreciate a new building using the double declining-balance depreciation method. The building cost is $820,000. The estimated residual value of the building is $52,000 and it has an expected useful life of 25 years. Assuming the first year's depreciation expense was recorded properly, what would be the amount of depreciation expense for the second year NEED HELP!!!!!!!!!!!!!