ayudenme no se como hacer esa simple matriz
include <iostream>
using namespace std;
int main()
{
int matrix[3][3];
// asigning values, I suppose this is done allready.
for(int x=0;x<3;x++)
for(int y=0;y<3;y++)
matrix[x][y]=1;
}
// showing the matrix on the screen
for(int x=0;x<3;x++) // loop 3 times for three lines
for(int y=0;y<3;y++) // loop for the three elements on the line
cout<<matrix[x][y]; // display the current element out of the array
cout<<endl; // when the inner loop is done, go to a new line
return 0; // return 0 to the OS.
Copyright © 2024 Q2A.ES - All rights reserved.
Answers & Comments
Verified answer
include <iostream>
using namespace std;
int main()
{
int matrix[3][3];
// asigning values, I suppose this is done allready.
for(int x=0;x<3;x++)
{
for(int y=0;y<3;y++)
{
matrix[x][y]=1;
}
}
// showing the matrix on the screen
for(int x=0;x<3;x++) // loop 3 times for three lines
{
for(int y=0;y<3;y++) // loop for the three elements on the line
{
cout<<matrix[x][y]; // display the current element out of the array
}
cout<<endl; // when the inner loop is done, go to a new line
}
return 0; // return 0 to the OS.
}