Question

make an array of 3 rows and 5 columns with integers. choose the integers by hand....

make an array of 3 rows and 5 columns with integers. choose the integers by hand. Print out the original array with the integers. Next print out the array in 1) hexadecimal and then in 2) ASCII characters.

1 1
Add a comment Improve this question Transcribed image text
Answer #1

Please find the code below:

#include <iostream>

using namespace std;

int main()

{

int array[3][5] = {

{61,62,63,64,65},

{66,67,68,69,70},

{91,92,93,94,95}};

int row=3;

int column = 5;

cout<<"Original array content"<<endl;

for(int i=0;i<row;i++){

for(int j=0;j<column;j++){

cout<<array[i][j]<<" ";

}

cout<<endl;

}

cout<<endl;

cout<<"Array in hexadecimal content"<<endl;

for(int i=0;i<row;i++){

for(int j=0;j<column;j++){

cout<<hex<<array[i][j]<<" ";

}

cout<<endl;

}

cout<<endl;

cout<<"Array in ACSII character"<<endl;

for(int i=0;i<row;i++){

for(int j=0;j<column;j++){

char ascii = array[i][j];

cout<<ascii<<" ";

}

cout<<endl;

}

return 0;

}

output:

Console X terminated> CPPWorkspace.exe [C/C++ Application original array content 61 62 63 64 65 66 67 68 69 70 91 92 93 94 95 Array in hexadecimal content 3d 3e 3f 40 41 42 43 44 45 46 5b 5c 5d 5e 5f Array in ACSII character =>?@A

c code::::

#include <stdio.h>

int main()

{

int array[3][5] = {

{61,62,63,64,65},

{66,67,68,69,70},

{91,92,93,94,95}};

int row=3;

int column = 5;

printf("Original array content\n");

int i,j;
for(i=0;i<row;i++){

for(j=0;j<column;j++){

printf("%d ",array[i][j]);

}

printf("\n");
}

printf("\n");

printf("Array in hexadecimal content\n");

for( i=0;i<row;i++){

for(j=0;j<column;j++){

printf("%x ",array[i][j]);

}

printf("\n");

}

printf("\n");

printf("Array in ACSII character\n");

for(i=0;i<row;i++){

for(j=0;j<column;j++){

char ascii = array[i][j];

printf("%c ",ascii);

}

printf("\n");

}

return 0;

}

output:

Add a comment
Know the answer?
Add Answer to:
make an array of 3 rows and 5 columns with integers. choose the integers by hand....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hand-write code to declare a two dimensional array of 3 columns and 4 rows. The Array...

    Hand-write code to declare a two dimensional array of 3 columns and 4 rows. The Array will hold doubles. What is the array initialized to by default?

  • In Java. Make a multi dimension array of 2 rows and 5 columns. Put 10 random...

    In Java. Make a multi dimension array of 2 rows and 5 columns. Put 10 random whole numbers into the multi dimension array. Find the smallest number in the array. Search the array for odd numbers and display them along with their position in the array.

  • Use C: 3. In function main, declare a two-dimensional integer array with 5 rows and 4...

    Use C: 3. In function main, declare a two-dimensional integer array with 5 rows and 4 columns. Call the following functions from function main. Call a function createArray to seed the random number generator and to fill the two-dimensional array with random integers between -20 and +20. Parameters for this function should be the array and the number of rows and columns). Call a function signs to count the number of positive values, number of negative values and number of...

  • Write a piece of code that constructs a two-dimensional array of integers with 5 rows and...

    Write a piece of code that constructs a two-dimensional array of integers with 5 rows and 10 columns. Fill the array with a multiplication table, so that array element [i][j] contains the value i * j. Use nested for loops to build the array. java Program

  • Q is a TWO-DIMENSIONAL array of 3 rows and 3 columns. Write the statement to DISPLAY...

    Q is a TWO-DIMENSIONAL array of 3 rows and 3 columns. Write the statement to DISPLAY the value of the middle element of array Q. NOTE: Do not skip lines. Do not print an output label. ------------------------------- (T/F) The following statements store 75 into the first array element. int Score[10]; Score [1] = 75; ------------------------------- kindly help urgently

  • Define a two-dimensional int array which has 5 rows and 3 columns. The elements in array...

    Define a two-dimensional int array which has 5 rows and 3 columns. The elements in array is randomly initialized (using Math.random()). Write a method to find the maximum value in this two dimensional array; Write a method to find the average value in the array; Write a method to count how many elements are smaller than average; Write a method to copy contents in a two-dimensional array to a one-dimensional array. The method will return this one-dimensional array. Method is...

  • Consider a data frame named "a" with 4 rows and 3 columns populated with positive integers...

    Consider a data frame named "a" with 4 rows and 3 columns populated with positive integers and -1, where -1 denotes a missing value. Write an R command that replaces each -1 with NA.

  • Your array shall have 3 rows and 3 columns (row and column indices are from 0...

    Your array shall have 3 rows and 3 columns (row and column indices are from 0 to 2). You shall initialize all elements of your array with character 'v' Player-1 is assigned 'X' symbol and player-2 is assigned 'O' symbol. Player-1 shall start the game and enter row index and column index where (s)he wants to place an 'X'. The board is updated and displayed. Now player-2 is asked to enter row and column indices If any player tries to...

  • Write a Java program that does the following. a. Declare an integer 2D array with 5...

    Write a Java program that does the following. a. Declare an integer 2D array with 5 rows and 5 columns. b. Initialize the array's elements to random integers between 1 and 10 (inclusive). c. Display all the elements in the 2D array as a table of rows and columns. d. Display the row index and column index of all the even integers in the 2D array. e. Display the sum of first row's elements.

  • 1) Define a 2 dimensional arrays of doubles (3 rows by 3 columns) and 2) Read...

    1) Define a 2 dimensional arrays of doubles (3 rows by 3 columns) and 2) Read values from the user. 3) Print the numbers entered by the user in row major order 4) Print the numbers entered by the user in column major order import java.util.*; public class XXX_Chapter83 { public static void main(String[] args) { //creates array and stores values with input from user printArrayRowMajor (board); printArrayColumnMajor (board); } public static void printArrayRowMajor (int [] [] board) { //prints...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT