Question

Please code in C++! I'm not too sure what the blue box session is but I included it. Please help if you can

8.2: Lottery Winners A lottery ticket buyer purchases 10 tickets a week, always playing the same 10 5- digit lucky combinat

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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;
}

#include <iostream> 2 using namespace std; 3 int main() 4-{ int lottory[10]; //decalring array int winner,count=0; //declarin

output:

Enter 5 digit lottory numbers >>>12345 12222 11111 34567 45678 56789 13456 14567 15678 16789 Enter winner lottory number >>>1Enter 5 digit lottory numbers >>>12345 13456 14567 15678 16789 23456 24567 25678 26789 34567 Enter winner lottory number >>>1

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.

Add a comment
Know the answer?
Add Answer to:
Please code in C++! I'm not too sure what the blue box session is but I...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT