-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
int Array[] = {100,200, 300, 300, 200, 100, 100, 200};
int CountData = count (Array, Array + 8, 100);
cout << "100 appears " << CountData << " times.\n";
vector<int> VectorData (Array, Array+8);
CountData = count (VectorData.begin(), VectorData.end(), 200);
cout << "200 appears " << CountData << " times.\n";
return 0;
}
-
- 100 appears 3 times.
200 appears 3 times. - 100 appears 3 times.
- 200 appears 3 times.
100 appears 3 times. - 200 appears 3 times.
- None of these
- 100 appears 3 times.
Correct Option: A
In this program, We are counting the number of 100’s and 200’s in the Array.