Question?
A lottery ticket buyer purchases 10 tickets each week; always playing the same 5-digit Lucky combinations. Write a program that initializes an array an array of 10 integers and then allows the user to enter this weeks winning lottery number. The program will need to sort the integers (using a selection sort) and then search the list to determine if the winning lottery number is in the list of 10 the user played. Please define your array as:
int playerNumbers [10] = { 77777, 13579, 62483, 26792, 93121,
79422, 85647, 26791, 33445, 55555};
Input Validation: Ensure that the value entered by the user is not less than zero and is not greater than 99999.
I got the code in C++ but don't know how to convert it into C. since i have not yet taken c++. I am a studient and am totally lost on this one any help will do. Thanks in advance.
A lottery ticket buyer purchases 10 tickets each week; always playing the same 5-digit Lucky combinations. Write a program that initializes an array an array of 10 integers and then allows the user to enter this weeks winning lottery number. The program will need to sort the integers (using a selection sort) and then search the list to determine if the winning lottery number is in the list of 10 the user played. Please define your array as:
int playerNumbers [10] = { 77777, 13579, 62483, 26792, 93121,
79422, 85647, 26791, 33445, 55555};
Input Validation: Ensure that the value entered by the user is not less than zero and is not greater than 99999.
I got the code in C++ but don't know how to convert it into C. since i have not yet taken c++. I am a studient and am totally lost on this one any help will do. Thanks in advance.
include <iostream> using namespace std; int main() {int numbers[10]={13579,26791,26792,33445,55555, 62483,77777,79422,85647,93121}; int i,win=-1, n; cout<<"Enter the winning number: "; cin>>n; for(i=0;i<10;i++) if(n==numbers[i]) {cout<<n<<" is a winner!!! :)/>\n"; win=i; } if(win<0) cout<<"Sorry you did not win\n"; system("pause"); return 0; }