Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <ctime>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- const int arraySize = 7;
- int frequency[arraySize] = {1}; // this sets all array elements to 0
- for (int i = 0; i < 120; ++i)
- {
- frequency[1 + rand() % 6]++;
- }
- cout << "Face" << setw(13) << "Frequency" << endl;
- for (int face = 1; face < arraySize; ++face)
- {
- cout << setw(4) << face << setw(13) << frequency[face] << endl;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement