Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ARRAYS

Status
Not open for further replies.

mharvin

Instructor
Apr 6, 2001
3
0
0
PK
Anybody here could teach me how to create a program ( MULTIPLICATION table). The maximum value for the row and column is 10.) It should use arrays.

Example:

a = 5
b= 5

1 2 3 4 5
1 1 2 3 4 5
2 2 4 6 8 10
3 3 6 9 12 15
4 4 8 12 16 20
5 5 10 15 20 25

Can somebody send me a code.. thanks.
 
A nested for loop with the max value should do


cin>>val;
int** array = new int[val][val];// this may not work

// if above does not work do this
int ** array = (int**)(new int[val*val]);

then in the for loops have a row and column for loop

for(rows)
for(cols)
array[idx1][idx2] = idx1*idx2;

something like that should get you started.

Matt
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top