Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ **Edit** Open to other ways of doing this, however it must draw the winner from the tickets and not from the names. Since this

C++

**Edit** Open to other ways of doing this, however it must draw the winner from the tickets and not from the names. Since this is a raffle.

"You are creating a program for a raffle. The each ticket for the raffle costs 5 dollars to enter, and contestants may purchase a ticket as many times as they like. When entries for the raffle are closed, one winning ticket is selected at random. The winner gets 75% of the entry fees as a prize, and the company running the raffle keeps the remaining 25%. Your solution should have the following requirements: The program will prompt the user to enter a new name for each ticket sold The program will prompt the user to enter "Q" to finish selling tickets The program will randomly select a winner The program will display the total number of participants, the name of the winner, and the prize money won Assume each name is unique and keep names one word (no spaces). "

I have created two vectors. One for an individual name, and one for how many tickets they would like to purchase. What I wan't to do is after drawing a random number in range from 1 to total number purchased, say 13, to compare the number to the corresponding ticket in the vector for the winner. Example:image text in transcribed

Example of my syntax, keep in mind not all of it, but so you know how I format it:

#include #include #include #include

using namespace std;

int main() { int seedVal = time(0); srand(seedVal); vector Name; vector ticketsBought; string purchaser; int numBought, totalSold = 0; cout > purchaser; ect....

t First person bought 3 iaei IE eant to com porethain ticlet to tu valuls 1-3. The hat Person bought , thin compare at How? Erample enteres Maru Tai Mad nonu Vector 3 , ) 5 . J Can ount Purchased 1-34-5113 ( -1o, 1l-13the rangeto t First person bought 3 iaei IE eant to com porethain ticlet to tu valuls 1-3. The hat Person bought , thin compare at How? Erample enteres Maru Tai Mad nonu Vector 3 , ) 5 . J Can ount Purchased 1-34-5113 ( -1o, 1l-13the rangeto

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions