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

  C program to calculate power loss in transmission line

Write program in C to calculate the power loss in transmission line with resistance of 0.05 ohms/mile. Calculate power loss if 500 kW of power is transmitted from power generation station

  Structured programming using procedural languages

A a program that is called "Playing with Numbers or Letters".

  C assignment of curl library

C Assignment Curl library must be used To be done on linux, it should be compiled using the following command: gcc -Wall -ansi -pedantic NameOfFile.c -lncurses Please make sure it is commented with clarification Variable names in camel case

  Three or more dimensions

What kind of program, or problem, might necessitate arrays of three or more dimensions?

  Write program to declare the array of type float

Write down the c++ program which declares the array of 50 components of type float. Initialize array so that first 25 components are equal to square of the index variable.

  Programs written with inheritance

Many programs written with inheritance could be written with composition instead, and vice versa. Rewrite the classes Point3D, Sphere and Cylinder using composition rather than inheritance

  The mean and standard deviation

How do i write a program in c++ that use functions max, min, the total numbers, the mean and standard deviation to read a file text and return these values from the file text. note the file text has random numbers. note im not suppose to use arrays.

  Asks the user for the name of an input file and translates

Write a C++ program that asks the user for the name of an input file and translates the contents of that input file using ROT13. Your  main  function should be responsible for reading the input file and coordinating calls to a value-returning functio..

  Write a menu-driven program that maintains an address book

Write a menu-driven program that maintains an address book using a linked list. The address book must supports the following operations

  Calculates the student * averages and quiz averages based

Calculates the student * averages and quiz averages based upon input from the user. Modify this program to read in the following grade text file, * with a maximum number of students set to 35 and having five quiz scores for each student. The output s..

  Computing value of the return statement

In the following code snippet, what is the value of the return statement for x = 4 and n = 4? int foo(int x, int n)

  Write a switch-case programming for calculation

How to use C++ to write a switch-case programming for calculation? Test the program for a wide range of possible inputs including division by zero and square root of negative values.

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