43 lines
714 B
C++
43 lines
714 B
C++
//Cristian Ronzoni 3Ain
|
|
/*Programma che stampa una scacchiera di bool
|
|
tramite una matrice
|
|
*/
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
#define LATO 7
|
|
using namespace std;
|
|
|
|
void stampaMatrice(bool arr[LATO][LATO]);
|
|
void scacchiera(bool arr[LATO][LATO]);
|
|
|
|
|
|
|
|
|
|
int main(void){
|
|
|
|
bool bobby[LATO][LATO];
|
|
scacchiera(bobby);
|
|
stampaMatrice(bobby);
|
|
|
|
|
|
}
|
|
|
|
void stampaMatrice(bool arr[LATO][LATO]){
|
|
for(size_t i = 0; i<LATO; ++i){
|
|
for(size_t j = 0; j<LATO; ++j){
|
|
cout << setw(3)<< arr[i][j];
|
|
}
|
|
cout << endl;
|
|
}
|
|
}
|
|
|
|
|
|
void scacchiera(bool arr[LATO][LATO]){
|
|
|
|
for(size_t i = 0; i<LATO; ++i){
|
|
for(size_t j = 0; j<LATO; ++j){
|
|
arr[i][j] = (i + j) % 2 == 0;
|
|
}
|
|
|
|
}
|
|
} |