I'm into video editing and since I'm interested in learning c++ I thought I could write something.
So I produce videos and often I need music.
So let's say the video is 7 minutes and 10 seconds long.
It's hard to find 7 minute songs so I prefer to put 2 songs.
Now here's the tricky part:
The program should calculate 7 min 10 sec - 4 min 25 sec = 2 min 45 sec
In other words timeneeded (7:10) minus song1 (4:25) = song2 (2:45)
And the program should output you need one more song 2 min and 45 sec long.
I've been struggling with the conversions, I could get the minutes but I need seconds aswell. Tried some google help but I can't seem to figure it out.
#include <iostream>
#include <cstdlib>
#define SECS_PER_MIN 60
usingnamespace std;
int main()
{
int a, b, c, d, e, f, g, h, i, j, secs_left;
cout << "Enter Minutes And Seconds: ";
cin >> a >> b; // a-min, b-sec
cout << "You entered " << a << " Minutes And " << b << " Seconds." << endl;
c=a*60; // a in sec
d=c+b; // total sec of a & b
cout << "Now Enter How Long Is The First Song In Minutes And Seconds: ";
cin >> e >> f; // e-min, f-sec
cout << "You enter " << e << " Minutes And " << f << " Seconds." << endl;
g=e*60; // e in sec
h=g+f; // total sec of e & f
i=d-h; // what I need minus first song in sec
j=i/60; // ^ in min
secs_left = i % SECS_PER_MIN; // remaining sec
cout << "You Need One More Song " << j << " Minutes And " << secs_left << " Seconds Long." << endl;
system ("pause");
return 0;
}