Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <iomanip>
- using namespace std;
- int main()
- {
- setlocale (LC_ALL,"Russian");
- float **a;
- int summ_poz=0;
- a=new float*[9];
- for(int i=0;i<9;i++)
- {
- a[i]=new float[4];
- for(int j=0;j<4;j++)
- {
- a[i][j]=0.1*(rand()%121-80);
- cout<<fixed<<" "<<setprecision(1)<<a[i][j]<<" ";
- }
- cout<<endl;
- }
- for(int i=0;i<9;i++)
- {
- for(int j=0;j<4;j++)
- {
- if(a[i][j]>0)
- {
- summ_poz++;
- }
- if(i==j)
- {
- a[i][j]=1;
- }
- }
- }
- cout<<endl;
- cout<<endl;
- cout<<endl;
- for(int i=0;i<9;i++)
- {
- for(int j=0;j<4;j++)
- {
- cout<<fixed<<" "<<setprecision(1)<<a[i][j]<<" ";
- }
- cout<<endl;
- }
- cout<<"Сумма положительных элементов "<<summ_poz<<endl;
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement