Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- srand (static_cast <unsigned> (time(0)));
- float LO = -99.9;
- float HI = 99.9;
- cout << "Masiv A[6,5] v intervali[-99.9;99.9]\n" << endl;
- cout << "Obrabotka a) C[n] = n(otricatelni) v kolona N ot A\n" << endl;
- cout << "Obrabotka b) sort(C)\n Paco" << endl;
- float A[6][5];
- for (int i = 0; i < 6; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- A[i][j] = LO + static_cast <float> (rand()) /( static_cast <float> (RAND_MAX/(HI-LO)));
- }
- }
- cout << "\n";
- for (int i = 0; i<6;i++)
- {
- for (int j = 0;j < 5;j++)
- {
- cout << A[i][j] << " ";
- }
- cout << "\n";
- }
- int C[5] = {0};
- for (int i = 0; i < 6; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- if(A[i][j] < 0)
- {
- C[j]++;
- }
- }
- }
- cout << "obrabotka a):\n";
- for (int i = 0; i < 5; i++)
- {
- cout << C[i] << " ";
- }
- cout << "\n";
- sort(C,C+5);
- cout << "obrabotka b):\n";
- for (int i =0;i<5;i++)
- {
- cout << C[i] << " ";
- }
- cout << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement