Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // re4(8).cpp
- /* this program generates a random number from a set of given numbers, 20 times */
- #include<iostream>
- #include<stdlib.h>
- #include<strings.h>
- using namespace std;
- int main()
- {
- int numbers[] = { 3, 13, 22, 57, 417 };
- int length = sizeof(numbers);
- for (int aa=1;aa<=20;aa++)
- {cout <<numbers[rand()%length]<< endl;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement