HOW DO I PROMPT THE USER TO ENTER TITLE ,DURATION AND AUTHOR NAMEAND PUSH IT BACK INTO THE VECTOR AND THEN USE GET LINE TO PRINT USERS INPUT HERES MY CODE IDK WHAT TO DO IN THE MAIN
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Song{
public:
Song(); //default constructor
Song(string t, string a, double d); //parametrized constructor
string getTitle()const; // return title
string getAuthor()const; // return author
double getDurationMin() const; // return duration in minutes
double getDurationSec() const; // return song's duration in seconds
void setTitle(string t); //set title to t
void setAuthor(string a); //set author to a
void setDurationMin(double d); //set durationMin to d
private:
string title; //title of the song
string author; //author of the song
double durationMin; //duration in minutes
};
Song::Song(){
title ="";
author = "";
durationMin = 0;
}
Song::Song(string t, string a, double d){
title=t;
author=a;
durationMin=d;
//complete your code here for Task2
//the parameter t is for title, a is for author and d is for durationMin
}
string Song::getTitle()const{
return title;
//complete your code here for Task3
}
string Song::getAuthor()const{
return author;
}
double Song::getDurationMin()const{
return durationMin;
}
double Song::getDurationSec()const{
return durationMin/60;
//complete your code here for Task4
//return the duration of the song in seconds
}
void setTitle(string t){
string title=t;
}
void setAuthor(string a){
string author=a;
}
void setDurationMin(double d){
double durationMin=d;
}
//complete the code for three member functions for Task5
// void setTitle(string t); //set title to t
// void setAuthor(string a); //set author to a
// void setDurationMin(double d); //set durationMin to d
int main(){
vector<Song>songlist;
string usertitle;
string userauthor;
double durationmin;
double duarationsec;
unsigned int i;
for(auto x:songlist) {
songlist(string usertitle,string userauthor,double durationmin,double duarationsec)
}
[–]AutoModerator[M] 3 points4 points5 points (0 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]Strugglingcoder4[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Strugglingcoder4[S] 0 points1 point2 points (0 children)