C++ multidimensional arrays explained ⬜

preview_player
Показать описание
#2d #multidimensional #array

C++ 2d multidimensional arrays tutorial example explained
Рекомендации по теме
Комментарии
Автор

#include <iostream>

int main() {

std::string cars[][3] = {{"Mustang", "Escape", "F-150"},
{"Corvette", "Equinox", "Silverado"},
{"Challenger", "Durango", "Ram 1500"}};

int rows =
int columns =

for(int i = 0; i < rows; i++){
for(int j = 0; j < columns; j++){
std::cout << cars[i][j] << " ";
}
std::cout << '\n';
}

return 0;
}

BroCodez
Автор

What a beautiful explanation of complex concept like 2 Dimensional Arrays. Mindblowing Video Sirji.

siddharthjain
Автор

For school we have to learn javascript...we had to learn 2d arrays but I needed someone to explain it in cpp first so I would get it. TYY!!!

Gamer-brfk
Автор

#include <iostream>

using namespace std;

int main() {

string peoples[] [2] = {{ "Eva", "Yula", "Lisa"},
{ "Artem", "Kirill", " Ivan"}};


int rows = sizeof(peoples) / sizeof(peoples[0]);
int columns = sizeof(peoples[0]) / sizeof(peoples[0][0]);

for ( int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
cout << peoples[i][j] << " ";
}
cout << '\n';
}

return 0;
}


Great lesson

artemzakharchuk
Автор

#include<iostream>

int main()
{
std::string students[][3] = {{"101", "Amit", "8.7"},
{"102", "Anuj", "8.4"},
{"103", "Ankit", "8.5"},
{"104", "Aditya", "7.9"},
{"105", "Anu", "8.9"}};

int rows =
int cols =

for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
std::cout << students[i][j] << "\t";
}
std::cout << "\n";
}

return 0;
}

lyfisntdaijobu
Автор

Giga Chad Busted, you are nice, you are catlike

TahaProgrammer
Автор

how do we take input from user and make them come in a matrix form

shahnawazmalik
Автор

#include <iostream>
using namespace std;
int main()
{
string foods[][3] = { { "beef", "lamb", "pork" }, // pork is haram (:
{ "tomato", "potato", "carrot" },
{ "aple", "mango", "melon" } };
int rows = 3;
int coloms = 3;
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < coloms; j++)
{
cout << foods[i][j]<< ' ';
}
cout << '\n';
}

ali.alsjad