#include <iostream>
#include <cmath>
#include <fstream>
#include <string>
#include <iomanip>
usingnamespace std;
int main()
{
int str_hh;
int str_mm;
int str_ss;
int inc_hh;
int inc_mm;
int inc_ss;
int end_hh;
int end_mm;
int end_ss;
int hh;
int mm;
int ss;
unsignedint hola0;
unsignedint hola1;
unsignedint hola2;
unsignedint facetime;
cout << "Give Me A Start Time:\n";
char sep;
cin >> str_hh >> sep >> str_mm >> sep >> str_ss;
hola0 = str_hh*3600 + str_mm*60 + str_ss;
cout << "Give Me An Increment Of Time:\n";
cin >> inc_hh >> sep >> inc_mm >> sep >> inc_ss;
hola1 = inc_hh*3600 + inc_mm*60 + inc_ss;
cout << "Give Me An End Time:\n";
cin >> end_hh >> sep >> end_mm >> sep >> end_ss;
hola2 = inc_hh*3600 + inc_mm*60 + inc_ss;
do
{
facetime = (hola0 += hola1);
hh = ( facetime / 3600 ) % 24 ; // %24 to handle roll over to the next day
mm = ( facetime / 60 ) % 60 ;
ss = facetime % 60 ;
cout << hh << ":" << mm << ":" << ss;
}
while (hola2 >= hola0);
return 0;
}
//so ... it stops after one iteration - so mess with it until the loop contnues
Your code is still not correct if the end time is after midnight (to start with, hola2 is less than hola0).
eg. start: 17:30:45 increment: 01:15:30 end: 04:30:50