Question

Check the file: Questions.pdf

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <sstream>
#include <map>
#include <vector>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <string>
using namespace std;

class Song {
public:
string title;
int time;
int track;
};

class Album {
public:
map <int, Song *> songs;
string name;
int time;
};

class Artist {
public:
map <string, Album *> albums;
string name;
int time;
int nsongs;
};


// Converts the string in m:ss format to seconds
int Time2Int(string s)
{
int min, sec;
sscanf(s.c_str(), "%d:%d\n", &min, &sec);
return min * 60 + sec;
}


// Converts seconds into string representing time in m:ss format
string Int2Time(int time)
{
ostringstream m, s;
string str;
m << time / 60;
s << time % 60;
str = s.str();
if (str.length() == 1) // adding leading zero if seconds < 10
{
str = "0" + str;
}
return m.str() + ":" + str;
}...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Algorithms Assignment
Homework Solution
$1.00
Algorithm
Computer Science
Graphs
Programming Language
Programming
Analysis
Kruskal Minimum Spanning Tree Algorithm Run on Example Graph
Homework Solution
$35.00
Benchmark
Report
Kruskal
Java
Report
Analysis
Complexity
Test
Case
Data
Problem
Critical
Operation
Comprehensive
Documentation
Approach
Lesson
Learned
Limitation
Expectation
Big-O
Graph
Input
Set
Introduction
Source
File
Code
M
The Longest Increasing Subsequence Problem
Homework Solution
$40.00
Programming
Computer Science
Longest Increasing Subsequence
Variables
Running Time
Algorithms
Complexity
Loops
Arrays
Get help from a qualified tutor
Live Chats