⚡ Cpp Program 🔥 Artist album tracks #tecqmate

#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>

using namespace std;

int main(){
	ifstream in("namedalbuminfo.txt");
	if(!in){
		cerr << "Failed to load input file!" << endl;
		return 1;
	}
	ofstream out("namedtracklist.txt");
	string line;
	int hours, mins, sum_hrs = 0, sum_mins = 0, count = 0, diff;
	getline(in, line);
	out << "Album title: " << line << endl;
	getline(in, line);
	out << "Artist: " << line << endl;
	cout << "Welcome to 's tracklist generator!" << endl;
	out << "Tracks:" << endl;
	out << "--------------------------------------------------" << endl;
	while(!in.eof()){
		count ++;
		getline(in, line);
		in >> hours >> mins;
		in.ignore();
		out << setfill('0') << setw(2) << count;
		out << " - " << line << ' ';
		out << hours << ':' << mins << endl;
		sum_hrs += hours;
		sum_mins += mins;
		diff = sum_mins - 60;
		if(0 < diff){
			sum_hrs ++;
			sum_mins = diff;
		}
	}
	out << "--------------------------------------------------" << endl;
	in.close();
	out.close();
	cout << "Processed " << count << " tracks." << endl;
	cout << "Total album length: " << sum_hrs << ':' << sum_mins << endl;
	cout << "Notes and Comments" << endl;
	return 0;
}
Bows + Arrows
The Walkmen
What's in It for Me
2 53
The Rat
4 27
No Christmas While I'm Talking
4 30
Little House of Savages
3 15
My Old Man
4 46
138th Street
3 2
The North Pole
3 48
Hang On, Siobhan
3 45
New Year's Eve
2 20
Thinking of a Dream I Had
4 33
Bows + Arrows
5 16

Comments

Popular posts from this blog