For each of the following sets of integers, write a single
statement that will print a number at random from the set.

c) 6,10,14,18,22

I can't do this in one line. the best i can do is:

num = 1;
while((num % 4) || (num > 24)) num = rand() % 24 + 8;
num -= 2;
cout << "Number in set {6,10,14,18,22}: " << num << endl;
return 0;

Any thoughts?