c++ - Displaying Issue Involving Time -


I have trouble in displaying "next day" in my program correctly, the assignment says, "Users Is encouraged to enter the current processing time - hours, minutes, seconds of the cruel time, your program will calculate the next processing time which is 30 minutes of the current processing time. Your program is currently processing timetable. And next processing time 1 next time 1 processing time 2 nextTime2. Next processing time goes the next day, you display next "next day" next to processing time (see sample output). / Strong>

Shows sample output:

current progress time = 23:50:10 | next process time = 0:20:10 (next day) | Next Process time 2 = 0:50:10

My problem occurs during the bold line "Next procedure is time 2 = 0:50:10, In my code it displays (the next day) in which it is not just for the previous row, "next process time" should be displayed (next day "), so my question is that I type my code at zero times :: display () What should be done by changing the function and it displays "next day" when the day is equal to one. Besides, I apologize that my question is not very specific, I am only in a loss and do not know what to do to fix this issue.

  #ifndef TIME_H # defined TIME_H class time-type {/ class definition private: int seconds; Int Min; Int hr; Int Day; // store information about variable days, you need to make the transition public on the following day: TimeType (); Zero SetTime (int s, int m, int h, int d); Timetype next process (zero); Zero performance (); }; #endif #include & lt; Iostream & gt; # Include & lt; Stdlib.h & gt; # Include & lt; Stdio.h & gt; #include "timetype.h" using namespace std; Time-type :: time-type () {sec = 0; Min = 0; Hr = 0; } Zero TimeType :: Settimes (int s, int m, int h, int d) {sec = s; Min = m; Hr = h; Day = D; } Time-type time-type :: Next process (zero) {long buf = 0; Int h, m, s, d; Buf = (day * 86400 + hr * 3600 + minute * 60 + second) + (30 * 60); // Calculate time in seconds required for allocation of time to reflect additional minutes = buff / 86400; // Recurring time for the day hours minutes minutes seconds H = (buf - 86400 * d) / 3600; M = (buff - 86400 * d - 3600 * H) / 60; S = (buf - 86400 * d - 3600 * h - 60 * m); TimType T; // buffer timetip object T.Settime (S, M, H, D); // Full buffer timetip object returns T; // return buffer timetip object} zero time type :: display () (if (day == 1) {printf ("% 02i:% 02i:% 02i" (next day) \ t ", hour, minute, second) ;} Other {printf ("% 02i:% 02i:% 02i \ t", hr, min, sec);}}; int main (int argc, char * argv []) {int hr = 0, min = 0 , Sec = 0; timetime cuttime, next time 1, next time 2; four t; do {system ("cls"); while (1) {cout>  <> "Please enter current processing hours." & Lt; & lt; endl; Cin & gt; hour; if (hr> = 0 & amp; hr & # 24; brake; cout & lt; & lt; "invalid input; retry . "& Lt; & Lt; andl & lt; endl;} Cout  Minute; if (Min> = 0 & amp; amp; minute & amp; 60) break; Cout  "Invalid input, retry." & Lt ; & Lt; andl & lt; endl;} Cout & lt; end;; (1) {cout & lt; & lt; "Please enter the current processing second." & Lt; & lt; Endl; Cin & gt; & Gt; Seconds; Break if (sec> = 0 & seconds & seconds & 60; Cout & lt; & Lt; "Invalid input, try again." & Lt; & Lt; Andal & lt; & Lt; Endl; } Cout & lt; & Lt; Endl; CurrTime.SetTime (second, minimum, hour, 0); NextTime1 = currTime.NextProcTime (); NextTime2 = next time 1. Next process (); Cout & lt; & Lt; "Current Process Time ="; CurrTime.Display (); Cout & lt; & Lt; Endl; Cout & lt; & Lt; "Next procedure time 1 ="; NextTime1.Display (); Cout & lt; & Lt; Endl; Cout & lt; & Lt; "Next procedure is time 2 ="; NextTime2.Display (); Cout & lt; & Lt; Endl; Cout & lt; & Lt; Andal & lt; & Lt; "Do you have more data to enter? (Y / n)" & lt; & Lt; Endl; Cin & gt; & Gt; T; Cout & lt; & Lt; Endl; } While (T == 'Y'); Return multiple times using // cycle; }  


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -