/*
6/49 lottery number generator
*/
#include "iostream"
#include "vector"
#include
using namespace std;
int main ()
{
int iRndNum;
vector
int i;
for(i=1; i <= 49; i++)
Numbers.push_back(i);
/* initialize random seed: */
srand (time(NULL) + rand());
cout << " The 6/49 numbers are" << endl;
for(i =1; i <= 6; i++){
/* generate a random number: */
iRndNum = rand() % (49 - i + 1) ;
cout << Numbers[iRndNum] << "\t";
Numbers.erase(Numbers.begin() + iRndNum, Numbers.begin() + iRndNum + 1);
}
cout << endl;
system("PAUSE");
return 0;
}
No comments:
Post a Comment