I'm kind of new to this and my program won't compile and I can't figure out why. I can't find any problems in my code. The programming challenge is to allow the user to enter a 5 digit number and then the program will search the list of 10 5-digit numbers in an array to see if one of them matches. It's a lottery-type program.
//Lottery winners
#include<iostream>
using namespace std;
bool findwinner(int[], int, int);
int main()
{
const int size=10;
int numbers[size]={13579, 26791, 26792, 33445, 55555, 62483, 77777, 79422, 85647, 93121};
int winningNumber;
cout<<"Enter the winning 5-digit lottery number this week.\n";
cin>>winningNumber;
bool result=findwinner(numbers, size, winningNumber);
if(result)
cout<<"Congratulations! You had a winning number!\n";
else
cout<<"Sorry, you didn't have a winning number.\n";
return 0;
}
bool findwinner(int numbers[], int size, int winningNumber)
{
bool win=false;
for(int i=0, i<size, i++)
{
if(numbers[i]==winningNumber)
win=true;
}
return win;
}
PLEASE USE CODE TAGS (the <> formatting button) when posting code. It makes it easier to read your code and it makes it easier to respond to your post. http://v2.cplusplus.com/articles/jEywvCM9/