34 lines
673 B
C++
34 lines
673 B
C++
#include <iostream>
|
|
#include <iomanip>
|
|
#include <math.h>
|
|
|
|
#include "fonctions.h"
|
|
|
|
using namespace std;
|
|
|
|
unsigned int nombre_de_Chiffres(unsigned int a) {
|
|
return log10(a) + 2;
|
|
}
|
|
|
|
void table_De_multiplication(unsigned int n) {
|
|
unsigned int espacement;
|
|
|
|
espacement = nombre_de_Chiffres(n*n);
|
|
cout << setw(espacement) << "";
|
|
|
|
for (unsigned int i = 1; i <= n; i++) {
|
|
cout << setw(espacement) << i;
|
|
}
|
|
cout << endl;
|
|
|
|
|
|
for (unsigned int y = 1; y <= n; y++) {
|
|
cout << setw(espacement) << y;
|
|
for (unsigned int x = 1; x <= n; x++) {
|
|
cout << setw(espacement) << x*y;
|
|
}
|
|
cout << endl;
|
|
}
|
|
|
|
|
|
} |