C++ multidimensional arrays explained ⬜

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • #2d #multidimensional #array
    C++ 2d multidimensional arrays tutorial example explained

КОМЕНТАРІ • 13

  • @BroCodez
    @BroCodez  2 роки тому +13

    #include
    int main() {
    std::string cars[][3] = {{"Mustang", "Escape", "F-150"},
    {"Corvette", "Equinox", "Silverado"},
    {"Challenger", "Durango", "Ram 1500"}};
    int rows = sizeof(cars)/sizeof(cars[0]);
    int columns = sizeof(cars[0])/sizeof(cars[0][0]);
    for(int i = 0; i < rows; i++){
    for(int j = 0; j < columns; j++){
    std::cout

  • @TahaProgrammer
    @TahaProgrammer Рік тому +2

    Giga Chad Busted, you are nice, you are catlike

  • @neveroddnoreven1553
    @neveroddnoreven1553 7 місяців тому

    Great stuff

  • @artemzakharchuk2842
    @artemzakharchuk2842 10 місяців тому +2

    #include
    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

    • @retardbuster1498
      @retardbuster1498 2 місяці тому

      It should be peoples[ ][3] , not peoples[ ][2] since you have 3 elements in each row which means 3 columns

  • @randomdude5634
    @randomdude5634 4 місяці тому

    good video man

  • @shahnawazmalik5291
    @shahnawazmalik5291 Рік тому +1

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

    • @shadowfall1700
      @shadowfall1700 Рік тому

      look at the video he make name "How to fill an array with user input" then you gather them in a 2D array

  • @AC0_0
    @AC0_0 Рік тому +1

    🥰

  • @user-lyf4isnt7daijobu
    @user-lyf4isnt7daijobu 2 місяці тому

    #include
    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 = sizeof(students)/sizeof(students[0]);
    int cols = sizeof(students[0])/sizeof(students[0][0]);
    for (int i = 0; i < rows; i++)
    {
    for (int j = 0; j < cols; j++)
    {
    std::cout

  • @ali.alsjad1
    @ali.alsjad1 9 місяців тому +3

    #include
    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