Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- int main() {
- int n,m;
- int an,am;
- srand (time(NULL));
- cin >> n;
- cin >> m;
- cout << endl;
- int tab[n][m];
- for (int i=1;i<=n;i++)
- {
- for(int j=1;j<=m;j++)
- {
- tab[i][j]=rand()%99+1;
- if (tab[i][j] >=10)
- {
- cout << tab[i][j] << " ";
- }
- else
- {
- cout << tab[i][j] << " ";
- }
- }
- cout << endl;
- }
- an=rand()%n+1;
- am=rand()%m+1;
- cout << "wybrane n i m to: ";
- cout << an;
- cout << endl;
- cout << am;
- cout << endl;
- cout << "A ta wartosc to: ";
- //cout << tab[an][am];
- int c;
- c=tab[an][am];
- cout << endl;
- int tmp;
- for (int i=1;i<=n;i++)
- {
- for(int j=1;j<=m;j++)
- {
- if (tab[i][j]<tab[i][j+1])
- {
- tmp=tab[i][j+1];
- tab[i][j]=tab[i][j+1];
- tab[i][j+1]=tmp;
- }
- if (tab[i][j] >=10)
- {
- cout << tab[i][j] << " ";
- }
- else
- {
- cout << tab[i][j] << " ";
- }
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement