Please code in C++! I'm not too sure what the blue box session is but I included it. Please help if you can
Answer:
#include <iostream>
using namespace std;
int main()
{
int lottory[10]; //decalring array
int winner,count=0; //declaring variables
cout<< "Enter 5 digit lottory numbers >>>";
for(int i=0;i<10;i++) //loop to taku user input
{
cin >> lottory[i]; //taking user input
}
cout << "Enter winner lottory number >>>";
cin >> winner; //taking user input
for(int i=0;i<10;i++) //loop to search lineraly
{
if(lottory[i]==winner) //linear search
{
cout << "You won the lottory"; // printing output
count++; //to check the case of not found
}
}
if(count==0) //case if not found the winner lottory card in your 10
cards
{
cout << "You didn't won the lottory"; //printing output
}
return 0;
}
output:
Note: Blue box session is just sample output to verify the code like the output I uploaded in this answer.Its just one test case to understand the question better.
Please code in C++! I'm not too sure what the blue box session is but I...