C++
The crossed out parts I already did. I did it by adding to a vector the name of the contestant by however many times they purchased a ticket. Example, say Tracy bought 3, the vector has Tracy's name 3 times. Then Marco bought 2, the vector now has Tracy's name 3 times and Marco's 2 times. Then I drew random index number to declare the winner. Ther is a variable to count how many contestants I have, in above example it is 2.
Part two I need help with. Thank you!
My vector example so you know my syntax: vector Name; Name.at(i); Name.push_back(Purchaser); //where purchaser variable is the cin from user input..... ect.
Part 1: (50 points) 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: e program w user to enter a new nam e program will prompt the user to e nter "Q" to finish selling tick ets The progra m will randomly select a winne he progran Il display the total number of participants, the name of the winner, and the prize Assume each name is unique and keep names one word (no spaces). Before moving on to part 2, ensure you have part 1 working and completed. Part 2: (20 points-10 bonus points) Extend the raffle program by adding the ability to view statistics about the entries. Display the names of each entry and the percent chance of them winning the raffle before determining the winner. Assuming no two people have the same name, determine how many tickets were purchased by each person, and divide that number by the total number of tickets to determine the percent chance of winning. Part 1: (50 points) 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: e program w user to enter a new nam e program will prompt the user to e nter "Q" to finish selling tick ets The progra m will randomly select a winne he progran Il display the total number of participants, the name of the winner, and the prize Assume each name is unique and keep names one word (no spaces). Before moving on to part 2, ensure you have part 1 working and completed. Part 2: (20 points-10 bonus points) Extend the raffle program by adding the ability to view statistics about the entries. Display the names of each entry and the percent chance of them winning the raffle before determining the winner. Assuming no two people have the same name, determine how many tickets were purchased by each person, and divide that number by the total number of tickets to determine the percent chance of winning