Your favorite artist is in concert in Charlotte this weekend. The local radio st
ID: 3882784 • Letter: Y
Question
Your favorite artist is in concert in Charlotte this weekend. The local radio station is giving away tickets. 4 billion entries have been made but there are only 18, 768 seats in the PNC Music Pavilion, but you won! You have some choice in the seat you get at the concert. There are seats in rows 22-58 available with 250 seats per row. Write a program that: Asks for the users name Asks you for the name of your favorite artist and outputs it Calculates and outputs the chance you had at winning if the radio station bought every seat Use a random number generator to determine where your seat might be located (row and seat number). Output a final statement that tells the user who they will be going to see and what seat they will be inExplanation / Answer
Hi, here is the complete code,
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
string name;
cout << "Enter your name: "<<endl;
getline(cin, name);
string artist;
cout << "Enter your favorite artist: "<<endl;
getline(cin, artist);
long int total=4000000000;
long int tickets=18768;
long double odds=tickets/total;
cout<<"odds of winning are "<<odds<<endl; //calculating odds
int row=22 + ( std::rand() % ( 58 - 22 + 1 ) ); //random number between 22 and 58
int seat=1 + ( std::rand() % ( 250 - 1 + 1 ) );//random number between 1 and 250
cout<<"you are going to see "<<artist<<"seated at row "<<row<<" in seat number "<<seat;
return 0;
}
THumbs up if this was helpful, otherwise let me know in comments. Good Day.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.