Here is the program :
/* A Lottery Program which uses to check
lottery buyer is same as the result
*/
#include<iostream>
using std::cout;
using std::endl;
using std::cin;
int main(int argc, char *argv[])
{
int loop, counter = 10;
int thisresult[10] = {13579, 26791, 26792, 33445,
55555, 62483, 77777, 79422,
85647, 93121};
// This week lottery result
int number_lottery;
// Number of user lottery
cout << "How many number of lottery : ";
cin >> number_lottery;
int *user_lottery = new int[number_lottery];
for (loop=0;loop<number_lottery;loop++)
{
cout << "Enter the lottery Number : ";
cin >> *(user_lottery + loop);
}
cout << "\n\nComparison is begin shortly\n\n";
counter = 10;
while(counter > 0)
{
cout << counter << "!" << "\n";
counter--;
}
// -------------------------------------
// Comparison Part/Linear Search
for (loop=0;loop<10;loop++)
{
if ( *(user_lottery + loop) == thisresult[loop] )
{
cout << "\n\nCongratulations, you are one of the winner";
cout << "\n\nThe winning ticket is " << *(user_lottery + loop);
}
}
delete [] user_lottery;
return 0;
}
/* I don't know binary search, if you know
please email me as follow :
[email protected]
Your help is greatly appreciated by me
*/
Linux is the best OS in the world.