Take an n x n matrix, and create a new, (n-1) x (n- 1)

Assignment Help C/C++ Programming
Reference no: EM13163388

take an N x N matrix, and create a new, (N-1) x (N- 1), matrix with each element being the sum of four nearby elements. You need to figure out a way to break the matrix up into squares and iterate through the matrix, while staying within its bounds. For example:

0 1 2

3 4 5

6 7 8

Result:

8 12

20 24

You need an iterative calculate_result() function that takes the original N x N array and fills the result array with the correct sum of the four neighboring elements, and also, you need a recursive_calculate_result()function that does the same thing as calculate_result but recursively. Requirements for your program:

o Read the N value from the user
o Initialize the N x N array
o Print the initial array and the resulting array
o All functions (including main) must not be more than 15 lines of code!!!

Reference no: EM13163388

Questions Cloud

What is the specific gravity of isopropyl alcohol : A 5.00 mL sample of isopropyl alcohol has a mass of .930 g whe measured at 20 degrees celsius. What is the specific gravity of isopropyl alcohol?
Write a single arm assembly language instruction equivalent : Write a single ARM assembly language instruction equivalent to a function that takes in three strings and checks if any are a substring to one another, if so return 1, if not return 0.
What is the ph at the equivalence point : A 25.0 mL sample of 0.150 M nitrous acid is titrated with a 0.150 M NaOH solution. What is the pH at the equivalence point? The Ka of nitrous acid is 4.50 x 10-4.
What does the balance of the account represent : What does the balance of the account represent? Where should the account appear in Southwest Airlines' financial statements?
Take an n x n matrix, and create a new, (n-1) x (n- 1) : take an N x N matrix, and create a new, (N-1) x (N- 1), matrix with each element being the sum of four nearby elements. You need to figure out a way to break the matrix up into squares and iterate through the matrix, while staying within its bounds.
A photo-sharing startup offers : A photo-sharing startup offers the following service. A client may upload any number N of photos and the server will compare each of the N pairs of photos with their proprietary image matching algorithms to see if there is any person that is in both ..
State a growth factor for cells : A growth factor for cells was identified from extracts of rat brain. Preliminary characterization was done on this activity using several methods.
How many grams of ch3oh must be added : How many grams of CH3OH must be added to water to prepare 150 mL of a solution that is 2.0 M CH3OH?
Revaluation and de-recognition of depreciable assets : Prepare journal entries to record the revaluation on 1 July 2013 and the subsequent sale on 1 July 2014 and revaluation and de-recognition of depreciable assets

Reviews

Write a Review

C/C++ Programming Questions & Answers

  How a base version of this assignment works

For this assignment you are to create an interactive moving sign in the context of a cityscape street scene. Click the link below to see how a base version of this assignment works. Type a message in the long blank slot at the top left, and then clic..

  Calculate the trajectory of a soccer ball

Write a program to calculate the trajectory (flight path) of a soccer ball

  Lu decomposition with gauss elimination

The LU decomposition with Gauss elimination and what is the physical interpretation of the elements of ? Write C++ programs for steps 2, 3, and 4.

  Function declare that it can throw an ioexception

Every C++ function that performs file I/O will thus need to either declare that it can throw an IOException, or contain a try-catch-finally block to deal with it. Response?

  A run is a sequence of adjacent repeated val

A   run   is   a   sequence   of   adjacent   repeated   values.   Using   an   array,   write   a   program   that   generates   a   sequence   of

  Write a program using the rand() function

Write a program using the rand() function and a large array to find the standard deviation, variance and mean as well as the min and max values of the array.

  Grocery store program

This program draws upon several concepts that were covered in CptS 121 and should serve as a good refresher for CptS 122. Our store, Cougar Mart, maintains its inventory in a text file. Not being very tech savvy, the owner of Cougar Mart needs you to..

  Computer programming techniques

Construct a program from a design and use appropriate functions

  Write c program to read one ip address

Write a C or C++ program which Read one IP address at a time from Dec_IPAddresses.txt and convert it into Hex. Store converted values stored in another file (e.g. HEX_IPAddresses.txt).

  Add 10 people to the line

Add 10 people to the line and process them. Each time you process someone, print out their ticket information. After all 10 have been serviced, print the average wait time. Below is an example of the time calls you will need and a wait function.

  Write a program to calculate existing angles

Write a program to calculate existing angles and do if and then from this, and to place fixed angles at certain position.

  Principle ofsuperposition to determine that system is linear

Apply the principle of superposition to determine whether the following systems are linear. Sketch what the plot of the function looks like.

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