Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream> ///////ZAD8/////
- #include<ctime>
- #include<cstdlib>
- #include<windows.h>
- #include<iomanip>
- using namespace std;
- int pobierz_n(int &n)
- {
- cout<<"Podaj n"<<endl;
- cin>>n;
- }
- int wypelnij_tablice(float **tab, int n)
- {
- for(int i=0;i<n;i++)
- {
- for(int j=0;j<n;j++)
- {
- if(j<=i)
- tab[i][j]=rand()/(RAND_MAX+1.0)*9+1;
- else tab[i][j]=0;
- }
- }
- }
- void wypisz(float **tab, int n)
- {
- cout<<endl;
- for(int i=0;i<n;i++)
- {
- for(int j=0;j<n;j++)
- {
- cout.width(4);
- cout<<setprecision(3)<<tab[i][j]<<" ";
- }
- cout<<endl<<endl;
- }
- }
- int kopiuj(float **tab,int n)
- {
- int g;
- for(int i=0;i<n;i++)
- {
- for(int j=0;j<n;j++)
- {
- tab[n-j-1][n-i-1]=tab[n-i-1][n-j-1];
- }
- }
- }
- int main()
- {
- srand(time(NULL));
- int n;
- pobierz_n(n);
- float **tablica=new float*[n];
- for(int i=0;i<n;i++)
- tablica[i]= new float[n];
- wypelnij_tablice(tablica,n);
- wypisz(tablica,n);
- kopiuj(tablica,n);
- wypisz(tablica,n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement