I have to create a project where i have to read and compare individual digits of a digital clock and output certain statements based on the comparison. For example if a user imputs 3:45 since the digits or in ascending order I have to cout >> All you dreams will come true. My question is how do I compare indivdual digits of a clock while still being able to let the user input their time as hours and minutes?
Well, you could set the input to a string, and check each character of the string- once it hits the colon, have it take all numbers left of the colon and input them into individual integer variables, and do the same with all of the numbers to the right. That way, not only will you have each number of the inputted time separated, but you also have them grouped into hours and minutes- and thus can make comparisons between them.