Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using C++ write the following program: 1) For the song program below, on a separ

ID: 3575212 • Letter: U

Question

Using C++ write the following program:

1) For the song program below, on a separate line write a function to quickly print the list of Streaming Services in your Song class, do not modify the program.

2). The Duration in your Song class contains minutes and seconds. Create a data structure called Duration to group the data, do not modify the program but with it on a separate line.

#include<iostream>
using namespace std;
struct Song
{
   string song_title;
   string performer;
   string writers;
   string streaming;
   string genre;
   string duration;
};
int main()
{
   struct Song s;
   cout<<" enter song title :";
   cin>>s.song_title;
   cout<<" enter performer : ";
   cin>>s.performer;
   cout<<" enter writers";
   cin>>s.writers;
   cout<<"enter streaming services : ";
   cin>>s.streaming;
   cout<<" enter genre : ";
   cin>>s.genre;
   cout<<"enter Duration : ";
   cin>>s.duration;
  
   cout<<" song title :"<<s.song_title;
   cout<<" performer : "<<s.performer;
   cout<<" writers : "<<s.writers;
   cout<<" streaming services : "<<s.streaming;
   cout<<" genre : "<<s.genre;
   cout<<" Duration : "<<s.duration;
   return 0;
}

Explanation / Answer

#include<iostream>

using namespace std;

void printServices(string);

struct Duration

{

int minutes;

int seconds;

};

struct Song

{

string song_title;

string performer;

string writers;

string streaming;

string genre;

struct Duration d;

};

int main()

{

struct Song s;

cout<<" enter song title :";

cin>>s.song_title;

cout<<" enter performer : ";

cin>>s.performer;

cout<<" enter writers";

cin>>s.writers;

cout<<"enter streaming services : ";

cin>>s.streaming;

cout<<" enter genre : ";

cin>>s.genre;

cout<<"enter minutes of Duration : ";

cin>>s.d.minutes;

cout<<"enter seconds of Duration : ";

cin>>s.d.seconds;

cout<<" song title :"<<s.song_title;

cout<<" performer : "<<s.performer;

cout<<" writers : "<<s.writers;

cout<<" streaming services : ";

printServices(s.streaming);

cout<<" genre : "<<s.genre;

cout<<" Duration : "<<s.d.minutes<<":"<<s.d.seconds;

return 0;

}

void printServices(string list){

for(int i=0;i<list.length();i++){

if(list[i]==',')

cout<<" ";

else

cout<<list[i];

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote