“Imprimer le tableau 2d C” Réponses codées

Imprimer le tableau 2D en C

// most of the time I forget that there should be matrix[i][j], not matrix[i]
#include <stdio.h>
// Abdullah Miraz
int main(){
    int i, j;

    int matrix[2][3] = {{2,3,4,5}, {7,8,9,1}};
    for(i=0;i< 2 ; i++){
        for(j=0;j<3;j++){
            printf("%d ", matrix[i][j]);
        }
    }
}
red-kid

C TAILLE IMPRESSION 2D

#include <stdio.h>

#define MAX 10

int main()
{
    char grid[MAX][MAX];
    int i,j,row,col;

    printf("Please enter your grid size: ");
    scanf("%d %d", &row, &col);


    for (i = 0; i < row; i++) {
        for (j = 0; j < col; j++) {
            grid[i][j] = '.';
            printf("%c ", grid[i][j]);
        }
        printf("\n");
    }

    return 0;
}
Exuberant Eagle

Imprimer le tableau 2D

2-D Vectors


vector<vector<int>> vect;

for (int i = 0; i < vect.size(); i++)
    {
        for (int j = 0; j < vect[i].size(); j++)
        {
            cout << vect[i][j] << " ";
        }   
        cout << endl;
    }
Alive Alligator

Réponses similaires à “Imprimer le tableau 2d C”

Questions similaires à “Imprimer le tableau 2d C”

Plus de réponses similaires à “Imprimer le tableau 2d C” dans C++

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code