lab7-1061

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <time.h> using namespace std; int main() { srand((unsigned) time(NULL)); int k,s,n=15,m=5,table[n][m],temp; cout << "Input K ans S values: "<<endl; cin>>k>>s; //filling the table for(int i=0;i<n;i++) { for(int j=0;j<m;j++) table[i][j]=rand()%20; } //show the table's content for(int i=k-1;i<s-1;i++) { for(int j=0;j<m;j++) { cout<<" "<<table[i][j]; } cout<<endl; } //reordering the rows if((k<n && s<n) && k<s) { for(int i=k-1;i<s-1;i++) { for(int j=0;j<m;j++) { temp=table[i][j]; table[i][j]=table[i+1][j]; table[i+1][j]=temp; } } } //show the table's content cout<<"Reodered :"<<endl; for(int i=k-2;i<s-1;i++) { for(int j=0;j<m;j++) { cout<<" "<<table[i][j]; } cout<<endl; } return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines