Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void Funkcja(int n, int m, float **tab)
- {
- float temp, *temp1, *bucket=new float[m];
- for(int i=0; i<n; i++)
- {
- bucket[i]=0;
- for(int j=0; j<m ;j++) {bucket[i]+=tab[i][j]; }
- }
- for(int i=0;i<n;i++)
- for(int j=1;j<n-i;j++)
- if(bucket[j-1]<bucket[j])
- {
- temp = bucket[j];
- bucket[j] = bucket[j-1];
- bucket[j-1] = temp;
- temp1 = tab[j];
- tab[j] = tab[j-1];
- tab[j-1] = temp1;
- }
- for(int i=0; i<3; i++)
- {
- //cout<<bucket[i]<<endl;
- for(int j=0; j<m; j++) {cout<<tab[i][j]<<" ";}
- cout<<endl;
- }
- }
- int main()
- {
- unsigned int n, m, p;
- cin>>n>>m>>p;
- float liczba;
- float **tab=new float*[m];
- for(int i=0; i<n; i++)
- {
- tab[i]=new float[n];
- for(int j=0; j<m; j++)
- {
- cin>>liczba;
- tab[i][j]=liczba;
- }
- }
- Funkcja(n, m, tab);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement