Please write this program in C++, thanks
Source Code::
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
enum genre{pop,Jazz,Classic}; //enum
//structure for album
struct album
{
string album_name;
genre kind;
int track_number;
string tracks[5];
string tracklocation;
};
//vector for keeping the data of the all albums
vector<album> v;
//temporary x1
album x1;
//it will add the album in the vector
void add_album()
{
int y;
cout<<"Enter album name\n";
cin>>x1.album_name;
cout<<"Enter genre 0->pop, 1->Jazz,
2->Classic\n";
cin>>y;
x1.kind=(genre)y; // typecasting for
int to enum
cout<<"Enter number of tracks in the
album\n";
cin>>x1.track_number;
cout<<"Enter the name for these
"<<x1.track_number<<" tracks\n";
for(int i=0;i<x1.track_number;i++)
cin>>x1.tracks[i];
cout<<"Enter the file location of these
tracks\n";
cin>>x1.tracklocation;
v.push_back(x1);// at the end of we puchback the
x1 into the vector
}
//it will just print all the album are in the vector
void print_all_album()
{
vector<album>::iterator itr;
for(itr=v.begin();itr!=v.end();itr++)
{
cout<<"Name of the
album : "<<itr->album_name;
cout<<"\nGenre of
the album : "<<itr->kind;
cout<<"\nNo. of
tracks :
"<<itr->track_number;
cout<<"\nTracks
are :\n";
for(int
i=0;i<itr->track_number;i++)
cout<<itr->tracks[i]<<endl;
cout<<"Tracks are
located at "<<itr->tracklocation<<endl;
}
}
// it will used for playing track and will print out a
statement
void select_track_to_play()
{
string s1,s2;
cout<<"Enter the album name\n";
cin>>s1;
cout<<"Enter the track name\n";
cin>>s2;
cout<<"When the user selects a
"<<s2<<" to play your program must call an external
program to play the track\n";
cout<<"play the track
"<<s2<<endl;
}
int main()
{
int ch;
do{
cout<<"\nEnter the option:\n ";
cout<<"1 to add an album\n ";
cout<<"2 to print the album details\n
";
cout<<"3 to play a track from an album\n
";
cout<<"4 to exit\n";
cin>>ch;
switch(ch)
{
case 1:
add_album();
break;
case 2:
print_all_album();
break;
case 3:
select_track_to_play();
break;
default:
cout<<"Invalid option\n";
}
}while(ch!=4);
return 0;
}
output::
output's screenshot are taken in one execution of program
Thank You!! if you liked the solution then please give the like to question
Please write this program in C++, thanks Task 9.3 Write a complete C++ program to create a music player Your program sh...
Write a C++ program that produces the following output: /* OUTPUT Enter your age: 21 Enter the last name: Lee Hello Tom Lee. You are 21 years old. Press any key */ Declare an array named: firstName The array is a c_string, i.e., it is a null-terminated character array. The size of the array is 10. Assign a first name to it when it is declared. Declare an array named: lastName The array is a c_string, The size of the...
C++ : Please include complete source code in answer This program will have names and addresses saved in a linked list. In addition, a birthday and anniversary date will be saved with each record. When the program is run, it will search for a birthday or an anniversary using the current date to compare with the saved date. It will then generate the appropriate card message. Because this will be an interactive system, your program should begin by displaying a...
*Answer must be in C* Write a complete program as follows (declare any necessary variables): Create an array of doubles named “hummus” with 2 rows and 300 columns. Initialize all array elements to zero. Write a loop that will repeatedly ask the user to enter a value and store it in the first row of the array (do not overwrite previously entered values) until the whole first row is populated with the user input. (hint the loop should have the...
(C++) Write a program that declares a struct to store the data of a football player (player’s name, player’s position, number of touchdowns, number of catches, number of passing yards, number of receiving yards, and the number of rushing yards). Declare an array of 10 components to store the data of 10 football players. Your program must contain a function to input data and a function to output data. Add functions to search the array to find the index of...
c++ CSI Lab 6 This program is to be written to accomplish same objectives, as did the program Except this time we modularize our program by writing functions, instead of writing the entire code in main. The program must have the following functions (names and purposes given below). Fot o tentoutefill datere nedefremfite You will have to decide as to what arguments must be passed to the functions and whether such passing must be by value or by reference or...
Please help!! (C++ PROGRAM) You will design an online contact list to keep track of names and phone numbers. · a. Define a class contactList that can store a name and up to 3 phone numbers (use an array for the phone numbers). Use constructors to automatically initialize the member variables. b.Add the following operations to your program: i. Add a new contact. Ask the user to enter the name and up to 3 phone numbers. ii. Delete a contact...
Please use C programming to write the code to solve the following problem. Also, please use the instructions, functions, syntax and any other required part of the problem. Thanks in advance. Use these functions below especially: void inputStringFromUser(char *prompt, char *s, int arraySize); void songNameDuplicate(char *songName); void songNameFound(char *songName); void songNameNotFound(char *songName); void songNameDeleted(char *songName); void artistFound(char *artist); void artistNotFound(char *artist); void printMusicLibraryEmpty(void); void printMusicLibraryTitle(void); const int MAX_LENGTH = 1024; You will write a program that maintains information about your...
Please write this in C. Write this code in Visual Studio and upload your Source.cpp file for checking (1) Write a program to prompt the user for an output file name and 2 input file names. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs opening any of the 3 For example, (user input shown in caps in first line) Enter first...
Write MIPS code, please. Following: Write a program to be used by the Wisconsin DNR to track the number of Deer Hunting Licenses issued in a county and the state. It will display a menu with 5 choices numbered 1-5. They are (1) update the count, (2) display the number of licenses already issued to a county whose number is input, (3) display the county number and the number of licenses already issued to a range of counties whose starting...
(C++) Please create a tic tac toe game. Must write a Player class to store each players’ information (name and score) and to update their information (increase their score if appropriate) and to retrieve their information (name and score).The players must be called by name during the game. The turns alternate starting with player 1 in the first move of round 1. Whoever plays last in a round will play second in the next round (assuming there is one).The rows...