So here's a homework problem that I'm a little stumped on... Let's say that you have a digital clock that doesn't display leading zeros in the hour time (so it would be 5:04 instead of 05:04). You are trying to create a program in which finds out the number of different arithmetic sequences between 12:00, and another user specified time. Arithmetic sequence - a series of numbers (in this case 3 for 4) that increment or decrement evenly Example - 1 2 3 4 or -5 -10 -15 -20 or 4 7 10 13 For example... If I wanted to find all the arithmetic sequences between 12:00 and 12:34, well then there'd only be one, 12:34 (notice how each number goes up by one). If I were to find all the arithmetic sequences between 12:00 and 1:35, then there'd be 4: 12:34, 1:11, 1:23, and 1:35. -------------------------------------------------------------------------------------------------------------- Example input (in minutes): 180 Example Output: 12:34 1:11 1:23 1:35 1:47 1:59 2:10 2:22 2:34 2:46 2:58 Explanation of Output: We start at the time 12:00, and have to find all the arithmetic sequences up to the time 3:00 (12:00 + 180 minutes = 3:00). The the rest is just straight forward. -------------------------------------------------------------------------------------------------------------- I have a basic sketch of the problem, but I can't seem to work out the pointer conversions. Whenever I run this code, it's doesn't give me any output. int startingTime = 1200; int *currentTime = &startingTime; int increment = 1; int userInputedTime; cin >> userInputedTime; // converts to 24 hour time for easier usage userInputedTime = userInputedTime / 60 * 100 + 1200; int *userInputedPointer = &userInputedTime; while (currentTime < userInputedPointer) { currentTime += increment; if (currentTime[1] - currentTime[0] == currentTime[2] - currentTime[1] == currentTime[3] - currentTime[2]) cout << currentTime << endl; incr

8/25/2019 5:19:31 PM

Fuzzy Squid1 Answer

New Answer
Welcome to SoloLearn forum!
One liner code is better or format code
C++ - Why a is assigned 1?
What to do after learning basis of Python?
What is data hiding?
Has there been any great programmer that's always only used ONE
Did the wordpress.com supports JS?
Is This good for my first ever code project?
Python arrays - Quite complicated an assignment....
Which is better HTML or css

Learn Playing. Play Learning

SoloLearn Inc.

5020 Franklin Drive, Suite 100

Pleasanton, CA 94588

© 2019 SoloLearn, Inc. All rights reserved.

Send us a message