#include <iostream>
#include <fstream>
#include <string>
#include <ctime>
usingnamespace std;
int main()
{
int a;
int b;
int c;
int d;
cout << "Please Give Me A Number & We Will Call It A (Start Time):\n";
cin >> a;
cout << "Please Give Me A Number & We Will Call It B (End Time):\n";
cin >> b;
cout << "Please Give Me A Number & We Will Call It C (Interval):\n";
cin >> c;
d = c + a;
do {c + a, cout << d;}
while ( c + a < b );
return 0;
}
#include <iostream>
#include <fstream>
#include <string>
#include <ctime>
usingnamespace std;
int main()
{
int a;
int b;
int c;
cout << "Please Give Me A Number & We Will Call It A (Start Time):\n";
cin >> a;
cout << "Please Give Me A Number & We Will Call It B (End Time):\n";
cin >> b;
cout << "Please Give Me A Number & We Will Call It C (Interval):\n";
cin >> c;
do
{
std::cout << a << "\n";//start from a/
a += c;//increment a by interval (c) ...
}while (a <= b);//... until we reach b (or thereabouts) ...
}
edit: you''ll of course need additional checks that b > a, c > 0 , input validation
c+a; is a do-nothing statement. It discards the sum and does nothing, effectively. You surely meant to assign something there which would affect C or A so that the loop would end.
GunnerFunner,
It works perfect - thank you for the distinction of increment over the introduction of a new variable.
I am looking to turn this code into a time creator. IE
Start Time - 08:00:00
End Time - 12:00:00
Increment - 00:15:00
0815
0830
0845
0900
0915
etc -
I am new to the process - I figured I would ask the masters on here. I will keep working on it. Thank you all so very much.