Community, I ask for your help with a small problem. I'm just learning C ++ and I've been working with arrays and arrays, I understand the logic of how to print a matrix and how it goes through its contents, but there are things that I can not solve yet. The following code shows how an array of AxA is printed (with the value 0) per terminal, where A is an input received by keyboard.
#include <iostream>
using namespace std;
int main( ) {
while( 1 ) {
int a = 0;
int i = 0;
int j = 0;
cout << "Ingresa dimensiones del cuadrado" << endl;
cin >> a;
if( cin.fail( ) ) {
cout << "Input incorrecto" << endl;
cin.clear( );
cin.ignore( );
} else {
for( i = 1; i <= a; i++ ) {
for( j = 1; j <= a; j++ ) {
cout << " o ";
}
cout << endl;
}
}
}
}
If the value of A is 4, you should print what appears in the image-point 1. However, I need only print the edges , that is, if the value of A is 4, the result should be the one seen in the image-point 2
This rule must be met for any value of a.
Thank you very much