Input data into 2d array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Input data into 2d array

I want to create a program were a user enters data into a 2d array using for loops, then display the results

11th Mar 2017, 3:12 PM
Ditshego Mosotho
Ditshego Mosotho - avatar
2 Answers
+ 15
int array[5][5]; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { //codes cin>>array[i][j]; } }
11th Mar 2017, 4:14 PM
Hatsy Rei
Hatsy Rei - avatar
+ 4
For Python ... d1 = [] for i in range(size_of_outer_array): d2 = [] for j in range(size_of_inner_array): x = input() d2.append(x) d1.append(d2) print d1 #prints the array
12th Mar 2017, 5:55 AM
Shirious
Shirious - avatar