Purchase Solution

C++ populating one and two dimensional arrays

Not what you're looking for?

Ask Custom Question

Define two pointers that hold two values of type int. Add these two pointers of type "int" and print the result on the screen.

Define a one dimensional array consisting of five cells, and populate the cells with values 0-5 and then print the result of the one dimensional array on the screen.

Define a two dimensional array of 6x6 cells. Its cells are populated with the value of one of the pointer times the value of one of the "FOR LOOP" variables, for example "i**pA". Print the result of the two dimensional array on the screen.

Write only one C++ code consisting of the above requirements. Output of your code should look like below:

The total of A and B is:6

****************************************

Content of one dimensional array is: 0

Content of one dimensional array is: 1

Content of one dimensional array is: 2

Content of one dimensional array is: 3

Content of one dimensional array is: 4

Content of one dimensional array is: 5

****************************************

Cell [0][0]=0

Cell [0][1]=4

Cell [0][2]=8

Cell [0][3]=12

Cell [0][4]=16

Cell [0][5]=20

Cell [1][0]=0

Cell [1][1]=4

Cell [1][2]=8

Cell [1][3]=12

Cell [1][4]=16

Cell [1][5]=20

Cell [2][0]=0

Cell [2][1]=4

Cell [2][2]=8

Cell [2][3]=12

Cell [2][4]=16

Cell [2][5]=20

Cell [3][0]=0

Cell [3][1]=4

Cell [3][2]=8

Cell [3][3]=12

Cell [3][4]=16

Cell [3][5]=20

Cell [4][0]=0

Cell [4][1]=4

Cell [4][2]=8

Cell [4][3]=12

Cell [4][4]=16

Cell [4][5]=20

Cell [5][0]=0

Cell [5][1]=4

Cell [5][2]=8

Cell [5][3]=12

Cell [5][4]=16

Cell [5][5]=20

Press any key to continue . . .

Purchase this Solution

Solution Summary

There is small flaw in posting. It is asking to define a one dimensional array consisting of five cells, and populate its cells with values of 0-5 (0-5 are six values: 0,1,2,3,4,5). Response defines a one dimensional array consisting of six cells, but guides with alternatives in case you want to work with an array of five cells.

Solution Preview

Attached source code (576446.cpp) is reasonably commented to help you understand what is being done there. It uses different values of A and B than the example output in your posting, so you will need to edit the source code appropriately to match its output with your example output.

There is small flaw in your ...

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Javscript Basics

Quiz on basics of javascript programming language.