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

  Binary search tree adt

Write a client method that returns a count of the number of nodes in a binary search tree that contain a value less than or equal to the argument value.

  Solving information technology question

XYZ Corporation has a small office with eighty users in California. The office employs a file and print server that caters to user requests.

  Data structures class

data structures class this project will give you an introduction. There are two important data structures that you will learn and use. The first is a stack, it is a LIFO (Last In First Out) structure. You can think of it like a a stack of plates in y..

  Write down a program which explores the seating patterns

write a program that explores the seating patterns related to course performance by using an array of student scores.

  Write an algorithm for stack using array

Write an algorithm for stack using array performing the operations as insertion, deletion, display, isempty, isfull.

  Design and develop a small or medium sized program

Write a C program that sorts strings into descending or ascending order (determined by the user of the program). develop your own program driver to illustrate that your program works. You may use any library functions you wish.

  Describe two different algorithms for finding spanning tree

Illustrate how the two algorithms you described in part (a) can be used to find the spanning tree of a simple graph, using a graph of your choice.

  1 describe the jsp life cycledraw a diagram of the various

1. describe the jsp life cycle.draw a diagram of the various events and transformations.for each part of the cycle

  Find average in binary tree using preorder traversal

Find average in binary tree using preorder traversal example for the function - Provide answer this question with example.

  Find shortest path tree by bellman-ford-dijkstra algorithm

Find the shortest path tree from every node to node 1for the graph of following figure using Bellman-Ford and Dijkstra algorithm.

  Instance of the single source shortest paths

instance of the single source shortest paths problem with vertex a as the source

  Give an algorithm that takes a sequence of points

Give an algorithm that takes a sequence of points in the plane (x1, y1), (x2, y2), ...., (xn, yn) and an integer k as input and returns the best piecewise linear function f consisting of at most k pieces that minimizes the sum squared error.

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