0
Multi-Dimensional Arrays
Type in a code to declare a multidimensional array with 2 rows and 3 columns. Enter the value using cin for the element in the second column of the second row. int arr[2][ ]; cin >> arr[ ][ ];
6 odpowiedzi
+ 4
This is Solution : Don't forget to Upvote
...................................................
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
int[,] num = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
//your code goes here
for(int i=0; i<3;i++)
{
for(int j=0;j<3;j++)
{
Console.WriteLine(num[i,j]);
}
}
}
}
}
+ 2
int arr[2][3 ];
cin >> arr[1 ][1 ];
+ 1
Two -Dimensional Arrays
cout << arr[ 0 ][ 1 ] <<endl;
ans: 0 and 1
0
answer 3 1 1
0
int arr[2][3 ];
cin >> arr[ 1][1 ];
- 2
Panji Darmawan where you are stuck? just declare array of two dimensions [][] like this and consider first aa row and second as column... use two for loop to have user input with help of cin