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
|
#include<iostream>
using namespace std;
int main()
{
int myMatrix[7][7]{1,0,2,0,-3,0,4,0,2,-3,0,4,0,-5,0,-3,0,4,0,-5,0,-3,0,4,0,-5,0,6,0,4,0,-5,0,6,0,4,0,-5,0,6,0,7};
const int rsize(7),csize(7);
int newMatrix[7][7];
int value,x,y,a,b;
int sum[i][j];
for(int i=0; i<6; i++)
{
for(int j=0; j<6; j++)
{
cout << myMatrix[i][j] << " ";
}
cout << endl;
}
cout<<"Enter an integer value: ";
cin>> value;
cout<<"Enter the beginning row and column offset you would like to modify: ";
cin>>x>>y;
cout<<"Enter the ending row and column offset: ";
cin>>a>>b;
for(int k=0; k<a; k++)
{
for(int l=0; l<y; l++)
{
newMatrix[k][l]=value;
sum= newMatrix[k][l]+myMatrix[k][l];
cout<< sum<<endl;
}
}
return(0);
}
|