Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <fstream>
- #include <stdlib.h>
- using namespace std;
- void fillarray(int array[]);
- int main()
- {
- srand(time(0));
- int count =0;
- int array[10];
- int i=0;
- while(i<10)
- {
- array[i]=0;
- i++;
- }
- fillarray(array);
- cout<<"Number of 0's "<<array[0]<<endl;
- cout<<"Number of 1's "<<array[1]<<endl;
- cout<<"Number of 2's "<<array[2]<<endl;
- cout<<"Number of 3's "<<array[3]<<endl;
- cout<<"Number of 4's "<<array[4]<<endl;
- cout<<"Number of 5's "<<array[5]<<endl;
- cout<<"Number of 6's "<<array[6]<<endl;
- cout<<"Number of 7's "<<array[7]<<endl;
- cout<<"Number of 8's "<<array[8]<<endl;
- cout<<"Number of 9's "<<array[9]<<endl;
- return 0;
- }
- void fillarray(int array[])
- {
- int count=0;
- while(count<100)
- {
- int add=(0+rand()%10);
- array[add]=array[add]+1;
- count++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement