1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#ifndef __calque_h__
#define __calque_h__
class Calque {
public:
const static int N = 16 ;
// constructeur par défaut
Calque( const int & defaultValue = 0 ){
// TODO amuse toi bien avec les boucles
}
// constructeur par recopie
Calque( const Calque & other ){
assign( other ) ;
}
// opérateur d'affectation
Calque& operator = ( const Calque & other ){
assign( other ) ;
return *this ;
}
~Calque(){
// pas de new, pas de delete : rien à faire ici
}
void assign( const Calque & other ){
// TODO amuse toi bien avec les boucles
}
int& operator() ( const int & i, const int& j ) {
return _data[i][j] ;
}
const int& operator() ( const int & i, const int& j ) const {
return _data[i][j] ;
}
const int& size1() const {
return N ;
}
const int& size2() const {
return N ;
}
private:
int _data[N][N];
};
std::ostream & operator << ( std::ostream& s, const Calque & calque ){
for ( int i = 0; i < calque.size1(); i++ ){
if ( i != 0 )
s << std::endl ;
for ( int j = 0; j < calque.size1(); j++ ){
if ( j != 0 )
s << " " ;
s << calque(i,j) ;
}
}
return s ;
}
#endif |