Calculate and print the sum of every value in the array

Assignment Help Data Structure & Algorithms
Reference no: EM131650915

Program 1: 2D Array manipulation

This first program concerns itself with 2D Arrays and Functions with array parameters. You are to create program in visual studio c++ 15 or 17. This compiler includes the new C++11 features that were defined in 2011 standard committee. You are to create a statically allocated 2D integer array called A of size 10 by 10. You are then requested to initialize this array, row by row using as looping construct. The first row contains the values 1 thru 10, the second row 11 thru 20, and so on until the last row is 91 thru 100. You are now requested to perform the following operations one after another in the order indicated. Document each section appropriately. Also if you are printing something like a sum then your output should include that info in the print. e.g. cout<<"The sum of the top row is "<<sum<<endl;

Program this problem incrementally. IE get step 1 to work then step 2 to work and so on. The form of your program should be as follows. This is the usual practice preached by SE's. Can you think of reasons this structure is often requested?

1. #includes
2. All Prototypes, function declarations
3. Main
4. Function Definitions

operations are

1. Dump the array. Note Dump() is the only function that is allowed to have cout's. e.g. no standard out output for the other functions. Dump means to print out the array a row at a time.

2. Print out the 4th row and the 7th column. This is not in a function. Just write inline code to do this. You can have cout's in main here;;

3. Calculate and print the sum of every value in the array using a function that you write called int Sum( int A[][], int numRows,int numCols)

4. Calculate the sum of the two diagonals. Now print the absolute value of their difference. You do not need a function here

5. Create a function called int BorderSum( int A[][], int numRows,int numCols) that returns the sum of the values that occur on all four sides of the array, e.g. the border. Call this function and print out the returned value.

6. Create a function called int InsideSum( int A[][], int numRows,int numCols) that returns the sum of the values on the inside of the array , e.g. sum of everything BUT the border. THINK! This is now easy.

7. Create a function called Transpose( int A[][], int numRows,int numCols) that will modify the array sent in by performing a transposeoperation on the array. If numRows!=numCols then do nothing otherwise flip the array about the main diagonal (upper left to lower right).

Print the above and combine it together with your source and output. Create two outputs, one with a 3 by 3 matrix and one with a 10 by 10 matrix. Staple together and hand in.

Reference no: EM131650915

Questions Cloud

Analyze the future of cybersecurity : Analyze the future of cybersecurity, including any opportunities for cooperation between the government and the private sector in creating
How long would the counseling process continue : George and Agnes are faithful members of their local congregation and have been Christians and served the Lord for many years.
Sketch a plausible set of indifference curves : Assume that the consumer purchases only two goods, x and y. Based on the information in each of the following parts, sketch a plausible set of indifference.
What strikes you as significant or the reasons why hebrew : What strikes you as significant or the reasons why the Hebrew, Egyptian and Mesopotamia societies were able to last as long as they did
Calculate and print the sum of every value in the array : Calculate and print the sum of every value in the array using a function that you write called int Sum( int A[][], int numRows,int numCols).
Define the role of diversity in the development of the arts : The role of diversity in the development of the arts and how it changed throughout the last century in the United States
Explain how the two results are equivalent : Pregnancy. In 1998 a San Diego reproductive clinic reported 42 live births to 157 women under the age of 38, but only 7 successes for 89 clients aged 38.
Explain your plan and incorporate your instructors feedback : Create a boardroom-quality Microsoft PowerPoint presentation of 10 to 12 slides detailing your plan and incorporating your instructor's feedback.
Make an appropriate display of the given data : Eating in front of the TV. Roper Reports asked a random sample of people in 30 countries whether they agreed with the statement.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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