Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void plusMinus(vector<int> arr)
- {
- float totalNum = float(arr.size());
- int pos = 0;
- int neg = 0;
- int zer = 0;
- for (int i = 0; i < totalNum; i++)
- {
- if (arr[i] < 0)
- {
- neg++;
- }
- else if (arr[i] > 0)
- {
- pos++;
- }
- else
- {
- zer++;
- }
- }
- cout << (pos / totalNum) << endl;
- cout << (neg / totalNum) << endl;
- cout << (zer / totalNum) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement