Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <iomanip>
- #include <time.h>
- using namespace std;
- int main()
- {
- srand(time(NULL));
- int arr[20][20];
- int positiveCount = 0;
- int negativeCount = 0;
- for (int i = 0; i < 20; i++)
- {
- for (int j = 0; j < 20; j++)
- {
- arr[i][j] = rand()%198 - 99;
- //cout << "arr[" << i <<"][" << j << "] = ";
- //cin >> arr[i][j];
- cout << setw(4) << arr[i][j];
- if (arr[i][j] > 0)
- positiveCount++;
- else if (arr[i][j] < 0)
- negativeCount++;
- }
- cout << endl;
- }
- cout << (positiveCount - negativeCount) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement