Below is the solution:
#include<iostream>
using namespace std;
int main()
{
// an array with 2 rows and 3 columns.
int n[2][3] = {{0,1,2}, {2,3,4}}; //(2X3) array
// output each array element's value
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3;
j++)
{
//print each
array element
cout <<
"Element at n[" << i << "][" << j << "]:
";
cout <<
n[i][j]<<endl;
}
}
return 0;
}
sample output:
Element at n[0][0]: 0 Element at n[0][1]: 1 Element at n[0][2]: 2 Element at n[1][0]: 2 Element at n[1][1]: 3 Element at n[1][2]: 4
write a program of c++ that will loop through a 2D array of size 2*3 ,...
Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D array of integers which is 10x10. 2. Prints out the contents of the 2D array after assigning the data to make sure correct data was assigned. 3. Figures out and prints out the square root of the sum of ALL the elements in the 2D array. 4. Figures out and prints out the average of ALL THE ELEMENTS in the 2D array. 5. Figures...
C++ Problems: 1. Write a program that reads in an array of user given size n and then it reads several increment values terminated by 0. The program calls each time a function incarray() that accepts an array A, its size S and an increment value inc and updates yje array by incrementing all its values by the passed value of inc. The program prints out the array after each update. 2. write a program that reads in a n...
In C++ for 2D Array: Write a program that uses a function that manipulates a 2D array of integers as follows: 1. Fill the first row and column in the array with random bits 2. Every subsequent cell should be filled as follows: 1. If the cells that are to the left and top of it are equal, then you should store their sum in it b. Otherwise, your program should store the highest among them. Test your function using...
C++ program Write a program which: 1. Enters data into the 2D array of integers which is 5x5 The data should be entered with an assignment statement using nested for loops that is do not scan in the data. The data should be: 1 2 4 8 16 1 3 9 27 81 1 4 16 64 256 1 5 25 125 625 1 6 36 216 1296 2. Print out the following using a nested for loop Row 0:...
Please I need code in C++ Write a program that creates an int array of size 10, then uses a for-loop to populate the array with numbers from your favorite number pattern.
In C language 1. Write a program to declare and initialize an array of size 5 and place odd numbers 3, 5, 7,9 and 11 in it. Declare and initialize another array of size 5 and place even numbers 4, 6, 8, 10 and 12 in it. Write a for loop to add each element and place it in a third array of the same dimensions. Display each array.
Write a C program that uses mallloc to create a 2D array. of c columns and r rows. Elements of array must be initialized to 0 and you must use malloc and free allocated memory fo array.
A short program loop goes through a 16 kB array one word at a time, reads a number from the array, adds a random number, and stores the result in the corresponding entry in another array that is located in the memory immediately following the first array. An outer loop repeats the above operation 100 times. The 64-bit processor, operating at a clock frequency of 4 GHz, is pipelined, has 48 address lines, three levels of caches with a 64...
A. Write an Array Program Write a main program that counts the number of occurrences of the number 6.0 in a large array of doubles and then prints out the number of elements in the array and the number of values that are 6.0. Also, compute and print the average value to 7 decimal places of all the elements in the array. 1. Use a for loop. The array fArray [ is defined in a file called Lab8Adatasetx.h that will...
Write a C++ program by using array with the size 10. The user will input the number between 0 to -10. Then, calculate and display by how many numbers in the array within the range -9 to -2.