TP: Boucles imbriquées et matrices
#include <iostream>
#include <fstream>
using namespace std;
int main(){
ofstream fout("output.txt");
int m,n;
cin >> m >> n;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++)
fout << "X";
fout << endl;
}
return 0;
}
#include <iostream>
#include <fstream>
using namespace std;
const int m=10,n=5;
int main(){
ifstream fin("input.txt");
int a,b,k,i,j;
int matrice[m][n];
k=1;
for (i = 0; i < m; i++)
for (j = 0; j < n; j++)
{
matrice[i][j]=k;
k++;
}
fin>>a>>b;
if (a<m and b<n)
cout<<matrice[a][b];
return 0;
}
n et qui affiche à l'écran toutes les paires n lignes de la façon suivante:
Rappel : une matrice
(
de
à
,
de
à
)
est dite symétrique si elle est égale à sa transposée, c'est-à-dire
si :