Advertisement
STANAANDREY

INS_LINIE

May 13th, 2019
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int n,i,j,a[100][100],k,m,v[100];
  7. cout<<"n=";cin>>n;
  8. cout<<"m=";cin>>m;
  9. cout<<"k=";cin>>k;
  10. for (i=0;i<n;i++)
  11.     for (j=0;j<m;j++)
  12.      cin>>a[i][j];
  13. cout<<"linie:"<<endl;
  14. for (i=0;i<m;i++)
  15.     cin>>v[i];
  16. for (i=n-1;i>=k;i--)
  17.     for (j=0;j<m;j++)
  18.     a[i+1][j]=a[i][j];
  19.  
  20.     for (j=0;j<m;j++)
  21.        a[k][j]=v[j];
  22. n++;
  23. cout<<endl<<"matricea noua:"<<endl;
  24.  
  25. for (i=0;i<n;i++) {
  26.     for (j=0;j<m;j++)
  27. cout<<a[i][j]<<' ';
  28. cout<<endl;
  29. }
  30.   return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement